X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=include%2Fdbstructure.php;h=94e8da4a44fbda632652204ecc4afe53f1acf1bf;hb=d49325d177cf03b97df250ca3cb081421c541049;hp=d3b148b2a8bfbf6b4e3dc83dbe4c7cc5e4e73bd2;hpb=c1611fd3f6b572f17eec04c113272a76667fdad7;p=friendica.git diff --git a/include/dbstructure.php b/include/dbstructure.php index d3b148b2a8..94e8da4a44 100644 --- a/include/dbstructure.php +++ b/include/dbstructure.php @@ -166,7 +166,8 @@ function update_structure($verbose, $action, $tables=null, $definition=null) { @$db->q($sql_config); // MySQL >= 5.7.4 doesn't support the IGNORE keyword in ALTER TABLE statements - if (version_compare($db->server_info(), '5.7.4') >= 0) { + if ((version_compare($db->server_info(), '5.7.4') >= 0) AND + !(strpos($db->server_info(), 'MariaDB') !== false)) { $ignore = ''; }else { $ignore = ' IGNORE'; @@ -196,7 +197,7 @@ function update_structure($verbose, $action, $tables=null, $definition=null) { if ($current_index_definition != $new_index_definition && substr($indexname, 0, 6) != 'local_') { $sql2=db_drop_index($indexname); if ($sql3 == "") - $sql3 = "ALTER TABLE `".$name."` ".$sql2; + $sql3 = "ALTER".$ignore." TABLE `".$name."` ".$sql2; else $sql3 .= ", ".$sql2; } @@ -442,6 +443,7 @@ function db_definition($charset) { "indexes" => array( "PRIMARY" => array("k".db_index_suffix($charset)), "updated" => array("updated"), + "expire_mode_updated" => array("expire_mode", "updated"), ) ); $database["challenge"] = array( @@ -556,6 +558,7 @@ function db_definition($charset) { "indexes" => array( "PRIMARY" => array("id"), "uid" => array("uid"), + "addr_uid" => array("addr", "uid"), "nurl" => array("nurl"), ) ); @@ -584,6 +587,7 @@ function db_definition($charset) { ), "indexes" => array( "PRIMARY" => array("id"), + "cmd_item_contact" => array("UNIQUE", "cmd", "item", "contact"), ) ); $database["event"] = array( @@ -708,6 +712,7 @@ function db_definition($charset) { "gender" => array("type" => "varchar(32)", "not null" => "1", "default" => ""), "birthday" => array("type" => "varchar(32)", "not null" => "1", "default" => "0000-00-00"), "community" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"), + "contact-type" => array("type" => "tinyint(1)", "not null" => "1", "default" => "-1"), "hide" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"), "nsfw" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"), "network" => array("type" => "varchar(255)", "not null" => "1", "default" => ""), @@ -913,7 +918,7 @@ function db_definition($charset) { "ownerid_created" => array("owner-id","created"), "wall_body" => array("wall","body(6)"), "uid_visible_moderated_created" => array("uid","visible","moderated","created"), - "uid_uri" => array("uid","uri"), + "uid_uri" => array("uid", "uri"), "uid_wall_created" => array("uid","wall","created"), "resource-id" => array("resource-id"), "uid_type" => array("uid","type"), @@ -1034,6 +1039,8 @@ function db_definition($charset) { "seen" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"), "verb" => array("type" => "varchar(255)", "not null" => "1", "default" => ""), "otype" => array("type" => "varchar(16)", "not null" => "1", "default" => ""), + "name_cache" => array("type" => "tinytext"), + "msg_cache" => array("type" => "mediumtext") ), "indexes" => array( "PRIMARY" => array("id"), @@ -1118,7 +1125,9 @@ function db_definition($charset) { ), "indexes" => array( "PRIMARY" => array("id"), - "uid" => array("uid"), + "uid_contactid" => array("uid", "contact-id"), + "uid_profile" => array("uid", "profile"), + "uid_album_created" => array("uid", "album", "created"), "resource-id" => array("resource-id"), "guid" => array("guid"), ) @@ -1271,6 +1280,7 @@ function db_definition($charset) { "uid" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"), "password" => array("type" => "varchar(255)", "not null" => "1", "default" => ""), "language" => array("type" => "varchar(16)", "not null" => "1", "default" => ""), + "note" => array("type" => "text"), ), "indexes" => array( "PRIMARY" => array("id"), @@ -1353,6 +1363,7 @@ function db_definition($charset) { "type_term" => array("type","term"), "uid_otype_type_term_global_created" => array("uid","otype","type","term","global","created"), "otype_type_term_tid" => array("otype","type","term","tid"), + "uid_otype_type_url" => array("uid","otype","type","url"), "guid" => array("guid"), ) ); @@ -1517,6 +1528,22 @@ function dbstructure_run(&$argv, &$argc) { return; case "update": update_structure(true, true); + + $build = get_config('system','build'); + if (!x($build)) { + set_config('system','build',DB_UPDATE_VERSION); + $build = DB_UPDATE_VERSION; + } + + $stored = intval($build); + $current = intval(DB_UPDATE_VERSION); + + // run any left update_nnnn functions in update.php + for($x = $stored; $x < $current; $x ++) { + $r = run_update_function($x); + if (!$r) break; + } + set_config('system','build',DB_UPDATE_VERSION); return; case "dumpsql":