]> git.mxchange.org Git - friendica.git/commitdiff
preserve local index of friendica database when updating
authorhauke <hauke@grlg.org>
Thu, 16 Apr 2015 19:05:37 +0000 (21:05 +0200)
committerhauke <hauke@grlg.org>
Thu, 16 Apr 2015 19:05:37 +0000 (21:05 +0200)
include/dbstructure.php

index 083255b8ae87ae4baf9ca612ec43c57500006922..0e7603753785ee0623e60563970a32c163e84b2c 100644 (file)
@@ -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) {