Error while creating relationships

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • artcien
    Junior Member
    • Jan 2018
    • 18

    Error while creating relationships

    I need some help here please.

    I just created a new Company Entity called HOA Management and I'm trying to create a relationship one-to-many with Opportunities (I changed the name to Deals) but it gives me an Error 500 and referred me to the log (below)

    After that I can't rebuilt the database unless I delete the new module HOA Management. I also tried creating the entity as a "base type" but same error.

    I have no clue here... could someone point me to the right direction??

    Thanks,

    [2018-02-19 23:59:41] Espo.ALERT: Rebuild database fault: PDOException: SQLSTATE[42000]: Syntax error or access violation: 1072 Key column 'h_o_a_management_id' doesn't exist in table in C:\Bitnami\office\apps\espocrm\htdocs\vendor\doctr ine\dbal\lib\Doctrine\DBAL\Connection.php:699 Stack trace: #0 C:\Bitnami\office\apps\espocrm\htdocs\vendor\doctr ine\dbal\lib\Doctrine\DBAL\Connection.php(699): PDO->query('CREATE INDEX ID...') #1 C:\Bitnami\office\apps\espocrm\htdocs\application\ Espo\Core\Utils\Database\Schema\Schema.php(215): Doctrine\DBAL\Connection->executeQuery('CREATE INDEX ID...') #2 C:\Bitnami\office\apps\espocrm\htdocs\application\ Espo\Core\DataManager.php(93): Espo\Core\Utils\Database\Schema\Schema->rebuild(NULL) #3 C:\Bitnami\office\apps\espocrm\htdocs\application\ Espo\Core\DataManager.php(60): Espo\Core\DataManager->rebuildDatabase(NULL) #4 C:\Bitnami\office\apps\espocrm\htdocs\application\ Espo\Controllers\Admin.php(51): Espo\Core\DataManager->rebuild() #5 C:\Bitnami\office\apps\espocrm\htdocs\application\ Espo\Core\ControllerManager.php(118): Espo\Controllers\Admin->postActionRebuild(Array, '', Object(Slim\Http\Request)) #6 C:\Bitnami\office\apps\espocrm\htdocs\application\ Espo\Core\Application.php(226): Espo\Core\ControllerManager->process('Admin', 'rebuild', Array, '', Object(Slim\Http\Request)) #7 [internal function]: Espo\Core\Application->Espo\Core\{closure}() #8 C:\Bitnami\office\apps\espocrm\htdocs\vendor\slim\ slim\Slim\Slim.php(1210): call_user_func_array(Object(Closure), Array) #9 C:\Bitnami\office\apps\espocrm\htdocs\vendor\slim\ slim\Slim\Slim.php(1356): Slim\Slim->applyHook('slim.before.dis...') #10 C:\Bitnami\office\apps\espocrm\htdocs\vendor\slim\ slim\Slim\Middleware\Flash.php(85): Slim\Slim->call() #11 C:\Bitnami\office\apps\espocrm\htdocs\vendor\slim\ slim\Slim\Middleware\MethodOverride.php(92): Slim\Middleware\Flash->call() #12 C:\Bitnami\office\apps\espocrm\htdocs\application\ Espo\Core\Utils\Api\Auth.php(112): Slim\Middleware\MethodOverride->call() #13 C:\Bitnami\office\apps\espocrm\htdocs\application\ Espo\Core\Utils\Api\Slim.php(125): Espo\Core\Utils\Api\Auth->call() #14 C:\Bitnami\office\apps\espocrm\htdocs\application\ Espo\Core\Application.php(88): Espo\Core\Utils\Api\Slim->run() #15 C:\Bitnami\office\apps\espocrm\htdocs\api\v1\index .php(33): Espo\Core\Application->run() #16 {main} Next Doctrine\DBAL\DBALException: An exception occurred while executing 'CREATE INDEX IDX_8389C3D72C5BB7AF ON `opportunity` (h_o_a_management_id)': SQLSTATE[42000]: Syntax error or access violation: 1072 Key column 'h_o_a_management_id' doesn't exist in table in C:\Bitnami\office\apps\espocrm\htdocs\vendor\doctr ine\dbal\lib\Doctrine\DBAL\DBALException.php:91 Stack trace: #0 C:\Bitnami\office\apps\espocrm\htdocs\vendor\doctr ine\dbal\lib\Doctrine\DBAL\Connection.php(702): Doctrine\DBAL\DBALException::driverExceptionDuring Query(Object(PDOException), 'CREATE INDEX ID...', Array) #1 C:\Bitnami\office\apps\espocrm\htdocs\application\ Espo\Core\Utils\Database\Schema\Schema.php(215): Doctrine\DBAL\Connection->executeQuery('CREATE INDEX ID...') #2 C:\Bitnami\office\apps\espocrm\htdocs\application\ Espo\Core\DataManager.php(93): Espo\Core\Utils\Database\Schema\Schema->rebuild(NULL) #3 C:\Bitnami\office\apps\espocrm\htdocs\application\ Espo\Core\DataManager.php(60): Espo\Core\DataManager->rebuildDatabase(NULL) #4 C:\Bitnami\office\apps\espocrm\htdocs\application\ Espo\Controllers\Admin.php(51): Espo\Core\DataManager->rebuild() #5 C:\Bitnami\office\apps\espocrm\htdocs\application\ Espo\Core\ControllerManager.php(118): Espo\Controllers\Admin->postActionRebuild(Array, '', Object(Slim\Http\Request)) #6 C:\Bitnami\office\apps\espocrm\htdocs\application\ Espo\Core\Application.php(226): Espo\Core\ControllerManager->process('Admin', 'rebuild', Array, '', Object(Slim\Http\Request)) #7 [internal function]: Espo\Core\Application->Espo\Core\{closure}() #8 C:\Bitnami\office\apps\espocrm\htdocs\vendor\slim\ slim\Slim\Slim.php(1210): call_user_func_array(Object(Closure), Array) #9 C:\Bitnami\office\apps\espocrm\htdocs\vendor\slim\ slim\Slim\Slim.php(1356): Slim\Slim->applyHook('slim.before.dis...') #10 C:\Bitnami\office\apps\espocrm\htdocs\vendor\slim\ slim\Slim\Middleware\Flash.php(85): Slim\Slim->call() #11 C:\Bitnami\office\apps\espocrm\htdocs\vendor\slim\ slim\Slim\Middleware\MethodOverride.php(92): Slim\Middleware\Flash->call() #12 C:\Bitnami\office\apps\espocrm\htdocs\application\ Espo\Core\Utils\Api\Auth.php(112): Slim\Middleware\MethodOverride->call() #13 C:\Bitnami\office\apps\espocrm\htdocs\application\ Espo\Core\Utils\Api\Slim.php(125): Espo\Core\Utils\Api\Auth->call() #14 C:\Bitnami\office\apps\espocrm\htdocs\application\ Espo\Core\Application.php(88): Espo\Core\Utils\Api\Slim->run() #15 C:\Bitnami\office\apps\espocrm\htdocs\api\v1\index .php(33): Espo\Core\Application->run() #16 {main} [] []
    [2018-02-19 23:59:41] Espo.ERROR: API [POST]:/Admin/rebuild, Params:Array ( ) , InputData: - Error while rebuilding database. See log file for details. [] []
    [2018-02-19 23:59:41] Espo.ERROR: Display Error: Error while rebuilding database. See log file for details., Code: 500 URL: /espocrm/api/v1/Admin/rebuild [] []

  • tanya
    Senior Member
    • Jun 2014
    • 4308

    #2
    Hello
    Could you remove custom/Espo/Custom/Resources/metadata/entityDefs/HOAManagement.json if exists?
    And if you meet in custom/Espo/Custom/Resources/metadata/entityDefs/Opportunity.json `hOAManagement`, remove this section as well. Check, if json is valid after modification. Try to rebuild Espo.
    The table in database is left and the columns in related tables as well, so, if you want, you can remove them manually.
    Last edited by tanya; 02-20-2018, 10:17 AM.

    Comment

    • artcien
      Junior Member
      • Jan 2018
      • 18

      #3
      Hi tanya

      Thank you for your help. Last night I ended up restoring from a backup and it now works fine.

      Comment

      Working...