Merge branch 'master' of ssh://172.20.0.1/var/git/espo/backend
This commit is contained in:
@@ -244,20 +244,16 @@ class Converter
|
||||
$uniqueIndex = array();
|
||||
foreach($relationParams['midKeys'] as $index => $midKey) {
|
||||
|
||||
$usMidKey = Util::toUnderScore($midKey);
|
||||
$table->addColumn($usMidKey, $this->idParams['dbType'], array('length'=>$this->idParams['len']));
|
||||
$table->addIndex(array($usMidKey));
|
||||
$columnName = Util::toUnderScore($midKey);
|
||||
$table->addColumn($columnName, $this->idParams['dbType'], array('length'=>$this->idParams['len']));
|
||||
$table->addIndex(array($columnName));
|
||||
|
||||
$uniqueIndex[] = $usMidKey;
|
||||
}
|
||||
|
||||
if (!empty($uniqueIndex)) {
|
||||
$table->addUniqueIndex($uniqueIndex);
|
||||
$uniqueIndex[] = $columnName;
|
||||
}
|
||||
//END: add midKeys to a schema
|
||||
|
||||
//add additionalColumns
|
||||
if (isset($relationParams['additionalColumns'])) {
|
||||
if (!empty($relationParams['additionalColumns'])) {
|
||||
foreach($relationParams['additionalColumns'] as $fieldName => $fieldParams) {
|
||||
|
||||
if (!isset($fieldParams['type'])) {
|
||||
@@ -271,6 +267,17 @@ class Converter
|
||||
}
|
||||
} //END: add additionalColumns
|
||||
|
||||
//add unique indexes
|
||||
if (!empty($relationParams['conditions'])) {
|
||||
foreach ($relationParams['conditions'] as $fieldName => $fieldParams) {
|
||||
$uniqueIndex[] = Util::toUnderScore($fieldName);
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($uniqueIndex)) {
|
||||
$table->addUniqueIndex($uniqueIndex);
|
||||
}
|
||||
//END: add unique indexes
|
||||
|
||||
$table->addColumn('deleted', 'bool', array('default' => 0));
|
||||
$table->setPrimaryKey(array("id"));
|
||||
@@ -278,7 +285,6 @@ class Converter
|
||||
return $table;
|
||||
}
|
||||
|
||||
|
||||
protected function getDbFieldParams($fieldParams)
|
||||
{
|
||||
$dbFieldParams = array();
|
||||
|
||||
Reference in New Issue
Block a user