onEntityTypeUpdate updates the installed entity schema without creating new tables or droping removed tables

Created on 6 December 2019, over 5 years ago
Updated 3 May 2023, about 2 years ago

Problem/Motivation

We track everything returned by \Drupal\Core\Entity\Sql\SqlContentEntityStorageSchema::getEntitySchema() and therefore we also report changes when tables are added or removed.

However if we perform an entity type update through:

$edum = \Drupal::entityDefinitionUpdateManager();
$edum->updateEntityType($edum->getEntityType($entity_type_id)));

then the installed schema will be updated to include the new tables, but the new tables will not be created and no changes will reported anymore.

Not only this, but there might be a new index on a new table and we are going to try to create it as we currently only auto create and auto delete indexes.

Proposed resolution

As we track the tables anyway and even report changes it makes sense to auto create and auto drop them just like we do with the indexes.

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

πŸ› Bug report
Status

Needs work

Version

10.1 ✨

Component
EntityΒ  β†’

Last updated about 16 hours ago

Created by

πŸ‡©πŸ‡ͺGermany hchonov πŸ‡ͺπŸ‡ΊπŸ‡©πŸ‡ͺπŸ‡§πŸ‡¬

Live updates comments and jobs are added and updated live.
  • Needs framework manager review

    It is used to alert the framework manager core committer(s) that an issue significantly impacts (or has the potential to impact) multiple subsystems or represents a significant change or addition in architecture or public APIs, and their signoff is needed (see the governance policy draft for more information). If an issue significantly impacts only one subsystem, use Needs subsystem maintainer review instead, and make sure the issue component is set to the correct subsystem.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024