Skip to content

Commit

Permalink
[db-errors] refactor some $columnName variable to $indexName
Browse files Browse the repository at this point in the history
  • Loading branch information
lukadschaak committed Apr 22, 2024
1 parent 4e50762 commit d7db477
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions models/DataObject/ClassDefinition/Helper/Dao.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,16 +75,16 @@ protected function addIndexToField(DataObject\ClassDefinition\Data $field, strin
if (is_array($columnType)) {
// multicolumn field
foreach ($columnType as $fkey => $fvalue) {
$columnName = $field->getName().'__'.$fkey;
if ($this->indexExists($table, $prefix, $columnName)) {
$this->db->executeQuery('ALTER TABLE `' . $table . '` DROP INDEX `' . $prefix . $columnName . '`;');
$indexName = $field->getName().'__'.$fkey;
if ($this->indexExists($table, $prefix, $indexName)) {
$this->db->executeQuery('ALTER TABLE `' . $table . '` DROP INDEX `' . $prefix . $indexName . '`;');
}
}
} else {
// single -column field
$columnName = $field->getName();
if ($this->indexExists($table, $prefix, $columnName)) {
$this->db->executeQuery('ALTER TABLE `' . $table . '` DROP INDEX `' . $prefix . $columnName . '`;');
$indexName = $field->getName();
if ($this->indexExists($table, $prefix, $indexName)) {
$this->db->executeQuery('ALTER TABLE `' . $table . '` DROP INDEX `' . $prefix . $indexName . '`;');
}
}
}
Expand Down

0 comments on commit d7db477

Please sign in to comment.