From 0d61e462fe844c8d2c38d2b85b21149827100ed4 Mon Sep 17 00:00:00 2001 From: hauke Date: Thu, 16 Apr 2015 21:05:37 +0200 Subject: [PATCH 1/2] preserve local index of friendica database when updating --- include/dbstructure.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/dbstructure.php b/include/dbstructure.php index 083255b8ae..0e76037537 100644 --- a/include/dbstructure.php +++ b/include/dbstructure.php @@ -151,15 +151,15 @@ function update_structure($verbose, $action, $tables=null, $definition=null) { 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; else $sql3 .= ", ".$sql2; - } + } // Compare the field structure field by field foreach ($structure["fields"] AS $fieldname => $parameters) { From 00cbc383f5cbbca5a3c8f107858781548f012c20 Mon Sep 17 00:00:00 2001 From: hauke Date: Thu, 16 Apr 2015 21:07:46 +0200 Subject: [PATCH 2/2] code cleanup --- include/dbstructure.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/dbstructure.php b/include/dbstructure.php index 0e76037537..012bb6f0bc 100644 --- a/include/dbstructure.php +++ b/include/dbstructure.php @@ -159,7 +159,7 @@ function update_structure($verbose, $action, $tables=null, $definition=null) { $sql3 = "ALTER TABLE `".$name."` ".$sql2; else $sql3 .= ", ".$sql2; - } + } // Compare the field structure field by field foreach ($structure["fields"] AS $fieldname => $parameters) {