"Espo.ALERT: Rebuild database fault: exception 'PDOException' ..."

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • gribs
    Senior Member
    • May 2015
    • 104

    "Espo.ALERT: Rebuild database fault: exception 'PDOException' ..."

    Hi

    First of all, thank you for your work !

    I have an issue : for no apparent reason I suddenly no longer able to create fields (error 500).

    So I read the espo logs.

    I see that :

    InputData: - Error while rebuilding database. See log file for details. [] []
    [2015-05-05 21:17:49] Espo.ERROR: Display Error: Error while rebuilding database. See log file for details., Code: 500 URL: /api/v1/Admin/rebuild [] []
    [2015-05-05 21:18:39] Espo.ALERT: Rebuild database fault: exception 'PDOException' with message 'SQLSTATE[42S21]: Column already exists: 1060 Duplicate column name 'field_of_the_death'' in /var/www/vhosts/my_website/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php:699
    Stack trace:
    #0 /var/www/vhosts/my_website/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(699): PDO->query('ALTER TABLE `co...')
    #1 /var/www/vhosts/my_website/application/Espo/Core/Utils/Database/Schema/Schema.php(203): Doctrine\DBAL\Connection->executeQuery('ALTER TABLE `co...')
    #2 /var/www/vhosts/my_website/application/Espo/Core/DataManager.php(84): Espo\Core\Utils\Database\Schema\Schema->rebuild(NULL)
    #3 /var/www/vhosts/my_website/application/Espo/Core/DataManager.php(53): Espo\Core\DataManager->rebuildDatabase(NULL)
    #4 /var/www/vhosts/my_website/application/Espo/Controllers/Admin.php(39): Espo\Core\DataManager->rebuild()
    #5 /var/www/vhosts/my_website/application/Espo/Core/ControllerManager.php(99): Espo\Controllers\Admin->actionRebuild(Array, '', Object(Slim\Http\Request))
    #6 /var/www/vhosts/my_website/application/Espo/Core/Application.php(213): Espo\Core\ControllerManager->process('Admin', 'rebuild', Array, '', Object(Slim\Http\Request))
    #7 [internal function]: Espo\Core\Application->Espo\Core\{closure}(NULL)
    #8 /var/www/vhosts/my_website/vendor/slim/slim/Slim/Slim.php(1175): call_user_func(Object(Closure), NULL)
    #9 /var/www/vhosts/my_website/vendor/slim/slim/Slim/Slim.php(1315): Slim\Slim->applyHook('slim.before.dis...')
    #10 /var/www/vhosts/my_website/vendor/slim/slim/Slim/Middleware/Flash.php(85): Slim\Slim->call()
    #11 /var/www/vhosts/my_website/vendor/slim/slim/Slim/Middleware/MethodOverride.php(92): Slim\Middleware\Flash->call()
    #12 /var/www/vhosts/my_website/application/Espo/Core/Utils/Api/Auth.php(95): Slim\Middleware\MethodOverride->call()
    #13 /var/www/vhosts/my_website/application/Espo/Core/Utils/Api/Slim.php(45): Espo\Core\Utils\Api\Auth->call()
    #14 /var/www/vhosts/my_website/application/Espo/Core/Application.php(83): Espo\Core\Utils\Api\Slim->run()
    #15 /var/www/vhosts/my_website/api/v1/index.php(26): Espo\Core\Application->run()
    #16 {main}

    Next exception 'Doctrine\DBAL\DBALException' with message 'An exception occurred while executing 'ALTER TABLE `contact` ADD field_of_the_death VARCHAR(255) DEFAULT NULL':

    SQLSTATE[42S21]: Column already exists: 1060 Duplicate column name 'field_of_the_death'' in /var/www/vhosts/my_website/vendor/doctrine/dbal/lib/Doctrine/DBAL/DBALException.php:91
    Stack trace:
    #0 /var/www/vhosts/my_website/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(702): Doctrine\DBAL\DBALException::driverExceptionDuring Query(Object(PDOException), 'ALTER TABLE `co...', Array)
    #1 /var/www/vhosts/my_website/application/Espo/Core/Utils/Database/Schema/Schema.php(203): Doctrine\DBAL\Connection->executeQuery('ALTER TABLE `co...')
    #2 /var/www/vhosts/my_website/application/Espo/Core/DataManager.php(84): Espo\Core\Utils\Database\Schema\Schema->rebuild(NULL)
    #3 /var/www/vhosts/my_website/application/Espo/Core/DataManager.php(53): Espo\Core\DataManager->rebuildDatabase(NULL)
    #4 /var/www/vhosts/my_website/application/Espo/Controllers/Admin.php(39): Espo\Core\DataManager->rebuild()
    #5 /var/www/vhosts/my_website/application/Espo/Core/ControllerManager.php(99): Espo\Controllers\Admin->actionRebuild(Array, '', Object(Slim\Http\Request))
    #6 /var/www/vhosts/my_website/application/Espo/Core/Application.php(213): Espo\Core\ControllerManager->process('Admin', 'rebuild', Array, '', Object(Slim\Http\Request))
    #7 [internal function]: Espo\Core\Application->Espo\Core\{closure}(NULL)
    #8 /var/www/vhosts/my_website/vendor/slim/slim/Slim/Slim.php(1175): call_user_func(Object(Closure), NULL)
    #9 /var/www/vhosts/my_website/vendor/slim/slim/Slim/Slim.php(1315): Slim\Slim->applyHook('slim.before.dis...')
    #10 /var/www/vhosts/my_website/vendor/slim/slim/Slim/Middleware/Flash.php(85): Slim\Slim->call()
    #11 /var/www/vhosts/my_website/vendor/slim/slim/Slim/Middleware/MethodOverride.php(92): Slim\Middleware\Flash->call()
    #12 /var/www/vhosts/my_website/application/Espo/Core/Utils/Api/Auth.php(95): Slim\Middleware\MethodOverride->call()
    #13 /var/www/vhosts/my_website/application/Espo/Core/Utils/Api/Slim.php(45): Espo\Core\Utils\Api\Auth->call()
    #14 /var/www/vhosts/my_website/application/Espo/Core/Application.php(83): Espo\Core\Utils\Api\Slim->run()
    #15 /var/www/vhosts/my_website/api/v1/index.php(26): Espo\Core\Application->run()
    #16 {main} [] []

    When I delete the field in entity manager, it says OK but the field comes back again. When I delete the table "field_of_the_death" directly in phpmyadmin, I'm able to create a new field and then no.. And the table reappears in phpmyadmin.

    I tried with and whithout cache, to rebuild but no luck

    can you help me with this crazy issue please?

    thank you

    ps : I have the latest production version
  • yuri
    Member
    • Mar 2014
    • 8440

    #2
    Hi

    Find your field in custom/Espo/Custom/Resources/metadata/entityDefs/ and try to remove from there.
    If you find EspoCRM good, we would greatly appreciate if you could give the project a star on GitHub. We believe our work truly deserves more recognition. Thanks.

    Comment

    Working...