X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=include%2Fdbstructure.php;h=012bb6f0bc857efa225ad0d44036f0a9272e9ce0;hb=cbe4e2bf8c7b6fea2e700811a15b427e6141c9dd;hp=f131abe64f13b489621c85114536ce3b3f6524cd;hpb=7c33c9cca16aa57f5a96c7f2dea8a181653fe0e8;p=friendica.git diff --git a/include/dbstructure.php b/include/dbstructure.php index f131abe64f..012bb6f0bc 100644 --- a/include/dbstructure.php +++ b/include/dbstructure.php @@ -120,7 +120,7 @@ function print_structure($database) { } } -function update_structure($verbose, $action) { +function update_structure($verbose, $action, $tables=null, $definition=null) { global $a, $db; $errors = false; @@ -130,7 +130,8 @@ function update_structure($verbose, $action) { // Get the current structure $database = array(); - $tables = q("show tables"); + if (is_null($tables)) + $tables = q("show tables"); foreach ($tables AS $table) { $table = current($table); @@ -139,7 +140,8 @@ function update_structure($verbose, $action) { } // Get the definition - $definition = db_definition(); + if (is_null($definition)) + $definition = db_definition(); // Compare it foreach ($definition AS $name => $structure) { @@ -149,9 +151,9 @@ function update_structure($verbose, $action) { if(false === $r) $errors .= t('Errors encountered creating database tables.').$name.EOL; } else { - // Drop the index if it isn't present in the definition + // Drop the index if it isn't present in the definition and index name doesn't start with "local_" foreach ($database[$name]["indexes"] AS $indexname => $fieldnames) - if (!isset($structure["indexes"][$indexname])) { + if (!isset($structure["indexes"][$indexname]) && substring($indexname, 0, 5) != 'local_') { $sql2=db_drop_index($indexname); if ($sql3 == "") $sql3 = "ALTER TABLE `".$name."` ".$sql2; @@ -453,6 +455,7 @@ function db_definition() { "uri-date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"), "avatar-date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"), "term-date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"), + "last-item" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"), "priority" => array("type" => "tinyint(3)", "not null" => "1", "default" => "0"), "blocked" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"), "readonly" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),