diff --git a/core/lib/Drupal/Core/Entity/RevisionableSchemaConverter.php b/core/lib/Drupal/Core/Entity/RevisionableSchemaConverter.php index 2e8abc9..ddd5e4c 100644 --- a/core/lib/Drupal/Core/Entity/RevisionableSchemaConverter.php +++ b/core/lib/Drupal/Core/Entity/RevisionableSchemaConverter.php @@ -157,6 +157,7 @@ protected function updateEntityType($entity_type_id, $options) { $entity_type->set('entity_keys', $keys); $entity_type->set('revision_table', $options['revision_table']); $entity_type->set('revision_data_table', $options['revision_data_table']); + $entity_type->data_migation = TRUE; $this->entityDefinitionUpdateManager->updateEntityType($entity_type); } diff --git a/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php b/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php index 475d706..1f147fb 100644 --- a/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php +++ b/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php @@ -228,6 +228,12 @@ protected function getSchemaFromStorageDefinition(FieldStorageDefinitionInterfac * {@inheritdoc} */ public function requiresEntityDataMigration(EntityTypeInterface $entity_type, EntityTypeInterface $original) { + // The data_migration property can be set to inform that data migration + // will be handled and it's ok to update the entity. + if (property_exists($entity_type, 'data_migation') && $entity_type->data_migation) { + return FALSE; + } + // If the original storage has existing entities, or it is impossible to // determine if that is the case, require entity data to be migrated. $original_storage_class = $original->getStorageClass(); @@ -300,7 +306,7 @@ public function onEntityTypeUpdate(EntityTypeInterface $entity_type, EntityTypeI // If a migration is required, we can't proceed. if ($this->requiresEntityDataMigration($entity_type, $original)) { - //throw new EntityStorageException('The SQL storage cannot change the schema for an existing entity type (' . $entity_type->id() . ') with data.'); + throw new EntityStorageException('The SQL storage cannot change the schema for an existing entity type (' . $entity_type->id() . ') with data.'); } if ($this->database->supportsTransactionalDDL()) {