diff --git a/module/VuFind/src/VuFind/Controller/Plugin/DbUpgrade.php b/module/VuFind/src/VuFind/Controller/Plugin/DbUpgrade.php index cc3b11a6dee4098922d857cc2d6a016bf54cf0f5..3d24e46aa7cb4d7957b02761bb5acfe801776846 100644 --- a/module/VuFind/src/VuFind/Controller/Plugin/DbUpgrade.php +++ b/module/VuFind/src/VuFind/Controller/Plugin/DbUpgrade.php @@ -291,6 +291,27 @@ class DbUpgrade extends AbstractPlugin return $type == $expectedType; } + /** + * Support method for getModifiedColumns() -- check if the current column is + * in the missing column list so we can avoid modifying something that does + * not exist. + * + * @param string $column Column to check + * @param string $missing Missing column list for column's table. + * + * @return bool + */ + public function columnIsMissing($column, $missing) + { + foreach ($missing as $current) { + preg_match('/^\s*`([^`]*)`.*$/', $current, $matches); + if ($column == $matches[1]) { + return true; + } + } + return false; + } + /** * Get a list of changed columns in the database tables (associative array, * key = table name, value = array of column name => new data type). @@ -335,7 +356,9 @@ class DbUpgrade extends AbstractPlugin $actualColumns = $this->getTableColumns($table); foreach ($expectedColumns as $i => $column) { // Skip column if we're logging and it's missing - if (in_array($column, $missingColumns)) { + if (isset($missingColumns[$table]) + && $this->columnIsMissing($column, $missingColumns[$table]) + ) { continue; } $currentColumn = $actualColumns[$column];