MySQL charset change improvements

This commit is contained in:
Taras Machyshyn
2018-03-02 15:42:26 +02:00
parent 0e1c611034
commit dcb1e8040a
2 changed files with 10 additions and 0 deletions
@@ -2,6 +2,7 @@
"fields": {
"name": {
"type": "varchar",
"maxLength": 249,
"required": true,
"trim": true
},
@@ -54,6 +54,15 @@ class MysqlCharacter extends \Espo\Core\Services\Base
$maxIndexLength = 1000;
}
//Account name
$sth = $pdo->prepare("SELECT `name` FROM `account` WHERE LENGTH(name) > 249");
$sth->execute();
$row = $sth->fetch(\PDO::FETCH_ASSOC);
if (empty($row)) {
$sth = $pdo->prepare("ALTER TABLE `account` MODIFY `name` VARCHAR(249)");
$sth->execute();
}
$fieldListExceededIndexMaxLength = \Espo\Core\Utils\Database\Schema\Utils::getFieldListExceededIndexMaxLength($ormMeta, $maxIndexLength);
foreach ($ormMeta as $entityName => $entityParams) {