Modules enabled:

  • Salesforce Integration
  • Salesforce Logger
  • Salesforce Mapping
  • Salesforce Pull

To replicate:

  • Updated salesforce from rc6 to rc7 using composer (Drupal 8.4.0 is installed and updated)
  • Installed `dynamic_entity_reference` version `8.x-2.0-alpha6`
  • Running `drush entity-updates` resulted in error
> ./vendor/bin/drush -y --root=$(pwd)/web entity-updates
The following updates are pending:

salesforce_mapped_object entity type : 
  The Salesforce Mapped Object entity type needs to be updated.
  The Mapped Entity field needs to be installed.
  The Entity ID field needs to be uninstalled.
  The Entity type field needs to be uninstalled.
webform_submission entity type : 
  The Language field needs to be updated.
Do you wish to run all pending updates? (y/n): y
Drupal\Core\Entity\Exception\FieldStorageDefinitionUpdateForbiddenException:[error]
Unable to delete a field (entity_id in salesforce_mapped_object
entity) with data that cannot be purged. in
Drupal\Core\Entity\Sql\SqlContentEntityStorageSchema->onFieldStorageDefinitionDelete()
(line 428 of
/path/to/project/web/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php).
Failed:                                                              [error]
Drupal\Core\Entity\Exception\FieldStorageDefinitionUpdateForbiddenException:
!message in
Drupal\Core\Entity\Sql\SqlContentEntityStorageSchema->onFieldStorageDefinitionDelete()
(line 428 of
/path/to/project/web/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php).

Comments

VladimirAus created an issue. See original summary.

vladimiraus’s picture

Issue summary: View changes
vladimiraus’s picture

Version: 8.x-3.0-rc7 » 8.x-3.x-dev

Confirmed same error for `3.x-dev` version

aaronbauman’s picture

You should:
1) make sure you have installed dynamic_entity_reference module - this is a new dependency
2) run updb and entup alternatively until the error goes away.

I was fighting this error for quite some time, but I'm pretty sure the above will fix it.
Please let me know either way

vladimiraus’s picture

Thanks @aaronbauman

  • `dynamic_entity_reference` is version `8.x-2.0-alpha6` and enabled
  • If i'll run `updb` before `entup` I'm getting
> ./vendor/bin/drush -y --root=$(pwd)/web updatedb
The following updates are pending:

salesforce module : 
  8002 -   Install new "Limit revisions" setting; defaults to 10 

salesforce_logger module : 
  8001 -   Install Salesforce Logger default log level. 

salesforce_mapping module : 
  8001 -   Copy entity_id-entity_type_id data into new mapped_entity field. 
  8002 -   Drop vestigial fields manually, since entity update refuses to do it. 

Do you wish to run all pending updates? (y/n): y
Refused to run salesforce_mapping_update_8001 with pending entity    [error]
definition updates. Please run `entup` first.
Performing salesforce_mapping_update_8001                            [ok]
Performing salesforce_update_8002                                    [ok]
Performing salesforce_logger_update_8001                             [ok]
Failed: Refused to run salesforce_mapping_update_8001 with pending   [error]
entity definition updates. Please run `entup` first.
vladimiraus’s picture

Priority: Normal » Minor

OK. Managed to succeed after running

drush updatedb
drush entity-updates
drush updatedb
drush entity-updates

Thanks for your help @aaronbauman

aaronbauman’s picture

When you have DER enabled, the first run of entup will add the DER field "drupal_entity__target_id", but fail to remove the 2 others.

Then, you run updb, which will run salesforce_mapping_update_8001() to copy the data from the old fields to the DER field, and salesforce_mapping_update_8002() to drop the old fields.

Then, you run entup again, which will get Drupal's record of the old fields up to date.

Then, you may need to run updb once more, and you may need to rebuild cache between each step.

Believe it or not, this was the simplest way I could figure out how to build this with as little direct manipulation of database as possible.
Seems like Drupal's update system has a lot of trouble with adding complex new dependencies for existing projects.

aaronbauman’s picture

Category: Bug report » Support request
Status: Active » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.