Announcement

Collapse
No announcement yet.

Upgrade problem from 5.9.4 to latest (SQLSTATE[HY000]: General error: 1366)

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Upgrade problem from 5.9.4 to latest (SQLSTATE[HY000]: General error: 1366)

    Hi. I'm having a problem upgrading our EspoCRM to latest version from 5.9.4. Logs are showing a rebuild problem related to an ALTER TABLE MySQL command:

    Code:
    [FONT=Courier New]Espo.ALERT: Rebuild database fault: PDOException: SQLSTATE[HY000]: General error: 1366 Incorrect integer value
    : ' ' for column 'id' at row 1 in /var/www/espocrm/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php:699 Stack trace: #0 /var/ww
    w/espocrm/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(699): PDO->query('ALTER TABLE `ac...') #1 /var/www/espocrm/applicati
    on/Espo/Core/Utils/Database/Schema/Schema.php(228): Doctrine\DBAL\Connection->executeQuery('ALTER TABLE `ac...') #2 /var/www/espocrm
    /application/Espo/Core/Utils/Database/Schema/SchemaProxy.php(53): Espo\Core\Utils\Database\Schema\Schema->rebuild() #3 /var/www/espo
    crm/application/Espo/Core/DataManager.php(122): Espo\Core\Utils\Database\Schema\SchemaProxy->rebuild(NULL) #4 /var/www/espocrm/appli
    cation/Espo/Core/DataManager.php(93): Espo\Core\DataManager->rebuildDatabase(NULL) #5 /var/www/espocrm/application/Espo/Core/Upgrade
    s/Actions/Base.php(737): Espo\Core\DataManager->rebuild() #6 /var/www/espocrm/application/Espo/Core/Upgrades/Actions/Base.php(170):
    Espo\Core\Upgrades\Actions\Base->systemRebuild() #7 /var/www/espocrm/application/Espo/Core/Upgrades/Actions/Base/Install.php(276): Espo\Core\Upgrades\Actions\Base->throwErrorAndRemovePackage('Error occurred ...', true, true) #8 /var/www/espocrm/application/Espo/Core/Upgrades/Actions/Base/Install.php(180): Espo\Core\Upgrades\Actions\Base\Install->throwErrorAndRemovePackage('Error occurred ...') #9 /var/www/espocrm/application/Espo/Core/Upgrades/Base.php(130): Espo\Core\Upgrades\Actions\Base\Install->stepRebuild(Array) #10 /var/www/espocrm/application/Espo/Core/Upgrades/Base.php(113): Espo\Core\Upgrades\Base->runActionStep('install', 'Rebuild', Array) #11 /var/www/espocrm/application/Espo/Core/Console/Commands/UpgradeStep.php(74): Espo\Core\Upgrades\Base->runInstallStep('Rebuild', Array) #12 /var/www/espocrm/application/Espo/Core/Console/Commands/UpgradeStep.php(63): Espo\Core\Console\Commands\UpgradeStep->runUpgradeStep('Rebuild', Array) #13 /var/www/espocrm/application/Espo/Core/Console/CommandManager.php(78): Espo\Core\Console\Commands\UpgradeStep->run(Array, Array, Array) #14 /var/www/espocrm/application/Espo/Core/ApplicationRunners/Command.php(56): Espo\Core\Console\CommandManager->run(Array) #15 /var/www/espocrm/application/Espo/Core/Application.php(107): Espo\Core\ApplicationRunners\Command->run(NULL) #16 /var/www/espocrm/command.php(39): Espo\Core\Application->run('Espo\\Core\\Appli...') #17 {main} Next Doctrine\DBAL\DBALException: An exception occurred while executing 'ALTER TABLE `account` CHANGE `id` `id` INT AUTO_INCREMENT NOT NULL COLLATE utf8mb4_unicode_ci': SQLSTATE[HY000]: General error: 1366 Incorrect integer value: ' ' for column 'id' at row 1 in /var/www/espocrm/vendor/doctrine/dbal/lib/Doctrine/DBAL/DBALException.php:91 Stack trace: #0 /var/www/espocrm/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(702): Doctrine\DBAL\DBALException::driverExceptionDuring Query(Object(PDOException), 'ALTER TABLE `ac...', Array) #1 /var/www/espocrm/application/Espo/Core/Utils/Database/Schema/Schema.php(228): Doctrine\DBAL\Connection->executeQuery('ALTER TABLE `ac...')
    #2 /var/www/espocrm/application/Espo/Core/Utils/Database/Schema/SchemaProxy.php(53): Espo\Core\Utils\Database\Schema\Schema->rebuild() #3 /var/www/espocrm/application/Espo/Core/DataManager.php(122): Espo\Core\Utils\Database\Schema\SchemaProxy->rebuild(NULL) #4 /var/www/espocrm/application/Espo/Core/DataManager.php(93): Espo\Core\DataManager->rebuildDatabase(NULL) #5 /var/www/espocrm/applicatio[/FONT]
    I've managed to ran the ALTER TABLE script available in the forum but again the error seems to be coming from the upgrade process.

    Any hint please?

    Rgds

    Nuno

  • #2
    Hi there,
    I'm curious of what the Incorrect integer value : ' ' for column 'id'. I guess this is an issue within the 'account' table. Could you check what a record has an empty id value in the account table?

    Comment


    • WhiteHat
      WhiteHat commented
      Editing a comment
      Hi Maximus. Yes it had, for some unknown reason to me, and I've created a different unique id value for that account.

  • #3

    x@espocrm:/www/espocrm# php command.php rebuild
    Rebuild has been done.

    x@espocrm:/www/espocrm# php command.php upgrade
    Current version is 5.9.4.
    EspoCRM will be upgraded to version 6.0.10 now. Enter [Y] to continue.
    Y
    Downloading...
    Upgrading... This may take a while..........

    Error: Error occurred while EspoCRM rebuild. Please see the log for more detail.x@espocrm:/www/espocrm#


    Looking at the log, this pops up:

    [2021-07-02 18:59:33] Espo.INFO: SCHEMA, Execute Query: ALTER TABLE `account` CHANGE `id` `id` INT AUTO_INCREMENT NOT NULL COLLATE utf8mb4_unicode_ci [] []

    I don't understand why is the upgrade script or rebuild trying to alter account.id column to INT when it should remain as VARCHAR...

    Cheers.

    Comment


    • #4
      Hi,
      Sorry for the delayed reply. It is weird behavior. Unfortunately I haven't idea. Please ask yuri or create a bug report here https://forum.espocrm.com/forum/bug-reports.

      Comment

      Working...
      X