impossible to upgrade 4.5.0 -> 4.5.1

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • piomio
    Junior Member
    • Apr 2017
    • 7

    impossible to upgrade 4.5.0 -> 4.5.1

    Hello,
    When I try to upgrade to 4.5.1 from 4.5.0, I get an error:
    Code:
    Error while rebuilding database. See log file for details.
    In the logs:
    Code:
    [2017-04-12 17:37:08] Espo.ERROR: Fault to rebuild database schema. Details: Unknown database type enum requested, Espo\Core\Utils\Database\DBAL\Platforms\MySqlPlatform may not support it. [] []
    [2017-04-12 17:37:08] Espo.ERROR: API [POST]:/:controller/action/:action, Params:Array (     [controller] => Admin     [action] => runUpgrade ) , InputData: {"id":"58ee65bfcb21a"} - Error while rebuilding database. See log file for details. [] []
    [2017-04-12 17:37:08] Espo.ERROR: Display Error: Error while rebuilding database. See log file for details., Code: 500 URL: /api/v1/Admin/action/runUpgrade [] []
    Thanks in advance for your help.
  • tanya
    Senior Member
    • Jun 2014
    • 4308

    #2
    In fact this error happened in an old project, I don't know what exactly made it happened. this error happens now when I want to rebuild the database from the admin panel, after a small search I fo...

    Comment

    • piomio
      Junior Member
      • Apr 2017
      • 7

      #3
      Thanks, but doesn't work. I get the following error when trying to rebuild the database from the admin panel:
      Code:
      [2017-04-24 10:23:06] Espo.ERROR: Uncaught Exception Error: "Call to a member function hasDoctrineTypeMappingFor() on null" at /home/infomast/crm/application/Espo/Core/Utils/Database/Schema/Schema.php line 188 {"exception":"[object] (Error(code: 0): Call to a member function hasDoctrineTypeMappingFor() on null at /home/infomast/crm/application/Espo/Core/Utils/Database/Schema/Schema.php:188)"} []
      I replaced the original code in Schema.php with this one, is it right?
      Code:
          protected function initFieldTypes()
          {
              foreach($this->fieldTypePaths as $path) {
      
                  $typeList = $this->getFileManager()->getFileList($path, false, '\.php$');
                  if ($typeList !== false) {
                      foreach ($typeList as $name) {
                          $typeName = preg_replace('/Type\.php$/i', '', $name);
                          $dbalTypeName = strtolower($typeName);
      
                          $filePath = Util::concatPath($path, $typeName . 'Type');
                          $class = Util::getClassName($filePath);
      
                          if( ! Type::hasType($dbalTypeName) ) {
                              Type::addType($dbalTypeName, $class);
                          } else {
                              Type::overrideType($dbalTypeName, $class);
                          }
      
                          $dbTypeName = method_exists($class, 'getDbTypeName') ? $class::getDbTypeName() : $dbalTypeName;
      
                          $this->getConnection()->getDatabasePlatform()->registerDoctrineTypeMapping($dbTypeName, $dbalTypeName);
                      }
                  }
              }
              if (!$databasePlatform->hasDoctrineTypeMappingFor('enum')) {
                  $databasePlatform->registerDoctrineTypeMapping('enum', 'string');
              }
       }
      Thanks.
      Last edited by piomio; 04-24-2017, 10:26 AM.

      Comment

      Working...