Hello Espo team,
we are currently upgrading EspoCRM from version 6.1.10 to 7.0.10. This upgrade fails because with the new version custom database types cannot be registered anymore.
Before we could register our own types with:
However with the modification of Espo\Core\Utils\Database\Schema\Schema.php in commit https://github.com/espocrm/espocrm/c...f125dcc76d4380 it was made impossible to register own types this way.
Resp. lines 61 to 65 (diff):
And in method initFieldTypes() lines 172 to 175 (diff):
Upgrading with php command.php upgrade produces now following error in the log file and upgrade fails:
How can we now cleanly register our own types? We need the types "uuid" and "datetime_immutable" which are present in other tables of the database.
----
- PHP-Version is 7.4.30
- DB-Version is MySQL 5.7.27
- Current Espo-Version: 6.1.10
we are currently upgrading EspoCRM from version 6.1.10 to 7.0.10. This upgrade fails because with the new version custom database types cannot be registered anymore.
Before we could register our own types with:
PHP Code:
namespace Espo\Custom\Core\Utils\Database\DBAL\FieldTypes;
use Doctrine\DBAL\Types\StringType;
class UuidType extends StringType
{
const UUID = 'uuid';
public function getName()
{
return self::UUID;
}
}
However with the modification of Espo\Core\Utils\Database\Schema\Schema.php in commit https://github.com/espocrm/espocrm/c...f125dcc76d4380 it was made impossible to register own types this way.
Resp. lines 61 to 65 (diff):
PHP Code:
- protected $fieldTypePaths = [
- 'application/Espo/Core/Utils/Database/DBAL/FieldTypes',
- 'custom/Espo/Custom/Core/Utils/Database/DBAL/FieldTypes',
- ];
+ private $fieldTypePath = 'application/Espo/Core/Utils/Database/DBAL/FieldTypes';
And in method initFieldTypes() lines 172 to 175 (diff):
PHP Code:
protected function initFieldTypes() {
- foreach ($this->fieldTypePaths as $path) {
- $typeList = $this->getFileManager()->getFileList($path, false, '\.php$');
+ $typeList = $this->getFileManager()->getFileList($this->fieldTypePath, false, '\.php$');
Upgrading with php command.php upgrade produces now following error in the log file and upgrade fails:
ERROR: Failed to rebuild database schema. Details: Unknown column type "uuid" requested. Any Doctrine type that you use has to be registered with \Doctrine\DBAL\Types\Type::addType(). You can get a list of all the known types with \Doctrine\DBAL\Types\Type::getTypesMap(). If this error occurs during database introspection then you might have forgotten to register all database types for a Doctrine Type. Use AbstractPlatform#registerDoctrineTypeMapping() or have your custom types implement Type#getMappedDatabaseTypes(). If the type name is empty you might have a problem with the cache or forgot some mapping information. at /var/www/html/vendor/doctrine/dbal/src/Exception.php:125
----
- PHP-Version is 7.4.30
- DB-Version is MySQL 5.7.27
- Current Espo-Version: 6.1.10
Comment