Error: Drupal\sitewide_alert\SitewideAlertStorage does not implement Drupal\Core\Entity\ContentEntityStorageInterface After (1.3.0 => 2.1.1) update

Created on 17 July 2023, 12 months ago
Updated 18 July 2023, 12 months ago

Problem/Motivation

I update a site from 1.3.0 => 2.1.1.

I run `drush cr` and then `drush updb`

I receive the following error:

> [notice] Update started: system_post_update_entity_revision_metadata_bc_cleanup
> [error] Drupal\sitewide_alert\SitewideAlertStorage does not implement Drupal\Core\Entity\ContentEntityStorageInterface
> [error] Update failed: system_post_update_entity_revision_metadata_bc_cleanup
[error] Update aborted by: system_post_update_entity_revision_metadata_bc_cleanup
[error] Finished performing updates.

I believe this is because the entity type definition is not updated correctly in database after file has been updated.

Workaround via drush (linux/git bash command line):

DRUSH_TEMP_COMMAND=$(cat <<'END' 
  $key_value = \Drupal::keyValue('entity.definitions.installed');
  $key_name = 'sitewide_alert.entity_type';

  $entity_type_data = $key_value->get($key_name);
  $handlers = $entity_type_data->get('handlers');
  $handlers['storage'] = 'Drupal\Core\Entity\Sql\SqlContentEntityStorage';
  $entity_type_data->set('handlers', $handlers);
  $key_value->set($key_name, $entity_type_data);
END
); ./vendor/bin/drush php-eval "$DRUSH_TEMP_COMMAND"

Steps to reproduce

Update a site from 1.3.0 => 2.1.1.

Proposed resolution

Add update hook to manually set content storage handler.

Remaining tasks

User interface changes

API changes

Data model changes

πŸ› Bug report
Status

Needs review

Version

2.1

Component

Code

Created by

πŸ‡¦πŸ‡ΊAustralia silverham

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.69.0 2024