Skip to content

Commit

Permalink
[FIX] ActiveRecord failed to create indices. Also create indices when…
Browse files Browse the repository at this point in the history
… calling ActiveRecord::updateDatabase()
  • Loading branch information
wanze committed May 4, 2016
1 parent 330855c commit 7b35848
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Services/ActiveRecord/Connector/class.arConnectorDB.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public function updateIndices(ActiveRecord $ar) {
$existing_indices[] = $rec->column_name;
}
foreach ($arFieldList->getFields() as $i => $arField) {
if ($arField->getIndex() === 'true') {
if ($arField->getIndex() === true) {
if (!in_array($arField->getName(), $existing_indices)) {
$ilDB->addIndex($ar->getConnectorContainerName(), array( $arField->getName() ), 'i' . $i);
}
Expand All @@ -96,6 +96,7 @@ public function updateDatabase(ActiveRecord $ar) {
$ilDB->addTableColumn($ar->getConnectorContainerName(), $field->getName(), $field->getAttributesForConnector());
}
}
$this->updateIndices($ar);

return true;
}
Expand Down

0 comments on commit 7b35848

Please sign in to comment.