It is impossible to save an existing entity for the second time as after pressing Update <Entity> button an error occurs:

Drupal\Core\Entity\Exception\FieldStorageDefinitionUpdateForbiddenException: The SQL storage cannot change the schema for an existing field ...

The same error happens when running drush entity-updates: all the ECK entities are display as being queued for an update.

Maybe it will be useful if I provide the output of our custom drush command which shows differences between Code/Schema/DB:

$ drush8 ct-bd
There are differences in definitions:                                                                                                                                                                                               [warning]
 Entity            Field  Target                  Code   Schema  DB       
 author            id     columns.value.type      "int"  "int"   "serial" 
 author            id     columns.value.not null  ""     ""      true     
 company           id     columns.value.type      "int"  "int"   "serial" 
 company           id     columns.value.not null  ""     ""      true     
 product           id     columns.value.type      "int"  "int"   "serial" 
 product           id     columns.value.not null  ""     ""      true     
...

As you see there are diffs between code/schema and the database.

Full error log:

The website encountered an unexpected error. Please try again later.

Drupal\Core\Entity\Exception\FieldStorageDefinitionUpdateForbiddenException: The SQL storage cannot change the schema for an existing field (id in author entity) with data. in Drupal\Core\Entity\Sql\SqlContentEntityStorageSchema->updateSharedTableSchema() (line 1376 of core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php).
Drupal\Core\Entity\Sql\SqlContentEntityStorageSchema->performFieldSchemaOperation('update', Object, Object) (Line: 397)
Drupal\Core\Entity\Sql\SqlContentEntityStorageSchema->onFieldStorageDefinitionUpdate(Object, Object) (Line: 1420)
Drupal\Core\Entity\Sql\SqlContentEntityStorage->Drupal\Core\Entity\Sql\{closure}() (Line: 1466)
Drupal\Core\Entity\Sql\SqlContentEntityStorage->wrapSchemaException(Object) (Line: 1421)
Drupal\Core\Entity\Sql\SqlContentEntityStorage->onFieldStorageDefinitionUpdate(Object, Object) (Line: 93)
Drupal\Core\Field\FieldStorageDefinitionListener->onFieldStorageDefinitionUpdate(Object, Object) (Line: 420)
Drupal\Core\Entity\EntityManager->onFieldStorageDefinitionUpdate(Object, Object) (Line: 238)
Drupal\Core\Entity\EntityDefinitionUpdateManager->doFieldUpdate(2, Object, Object) (Line: 116)
Drupal\Core\Entity\EntityDefinitionUpdateManager->applyUpdates() (Line: 109)
Drupal\eck\Entity\EckEntityType->postSave(Object, 1) (Line: 469)
Drupal\Core\Entity\EntityStorageBase->doPostSave(Object, 1) (Line: 395)
Drupal\Core\Entity\EntityStorageBase->save(Object) (Line: 259)
Drupal\Core\Config\Entity\ConfigEntityStorage->save(Object) (Line: 364)
Drupal\Core\Entity\Entity->save() (Line: 637)
Drupal\Core\Config\Entity\ConfigEntityBase->save() (Line: 137)
Drupal\eck\Form\EntityType\EckEntityTypeFormBase->save(Array, Object)
call_user_func_array(Array, Array) (Line: 111)
Drupal\Core\Form\FormSubmitter->executeSubmitHandlers(Array, Object) (Line: 51)
Drupal\Core\Form\FormSubmitter->doSubmitForm(Array, Object) (Line: 585)
Drupal\Core\Form\FormBuilder->processForm('eck_entity_type_edit_form', Array, Object) (Line: 314)
Drupal\Core\Form\FormBuilder->buildForm(Object, Object) (Line: 74)
Drupal\Core\Controller\FormController->getContentResult(Object, Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 603)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
call_user_func_array(Object, Array) (Line: 139)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 62)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 57)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 99)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 78)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 44)
Drupal\services\StackMiddleware\FormatSetter->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 50)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 652)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

Comments

OnkelTem created an issue. See original summary.

legolasbo’s picture

This is probably related to #2825407: Changes to eck.schema.yml trigger field changes which has a patch that provides an update path. That patch should probably fix this issue as well.

OnkelTem’s picture

Many thanks, I'll check it out!

legolasbo’s picture

@OnkelTem please report back if it fixed your problem so it can be committed.

legolasbo’s picture

Status: Active » Closed (duplicate)