Problem/Motivation
Currently entity type revisionability is not taken into account when determining whether marking fields as revisionable should trigger db updates. In fact, if the entity is not revisionable switching field revisionability shouldn't affect the final schema, at least for the default SQL storage.
Additionally, a field should be considered revisionable if and only if both the entity type and the storage definition are marked as revisionable, which is not the case currently.
Proposed resolution
- Mark sure updates are not triggered when switching field revisionability for non-revisionable entity types.
- Make sure both entity and field revisionability are taken into account when in code dealing with revisionable data.
Remaining tasks
- Validate the proposed solution
Write a patch
- Review it
User interface changes
None
API changes
Switching field revisionability no longer triggers entity definition updates when the entity type is not revisionable.
Beta phase evaluation
Comments
Comment #1
plachThis provides only the bug fix. Core field definitions revisionability is not switched yet.
Comment #4
plachFixed test failure
Comment #6
plachI decided to rescope this issue as marking field definitions as revisionable does not make sense unless definitions for revision metadata are added, in fact without them an entity type cannot be marked as revisionable.
Comment #7
plachUpdated IS, reviews welcome.
Comment #8
dawehnerIts interesting that its possible to have revisionable fields on non revisionable entity types and the other way round.
Given that this appears multiple times in the patch, I'm curious whether it would be worth to encapsulate this logic somewhere?
Comment #9
plachWell, revisionable for field storage definitions means "potentially revisionable", that is the whole point of this issue. Unless the entity type is revisionable, the revisionable property can be ignored, but once an entity type is made revisionable, having already decided which fields makes sense to revision allows to proceed smoothly.
Viceversa, if an entity type is revisionable we may still want to have non-revisionable fields, like the node type or UUID.
Comment #11
plachRerolled, this probably needs an upgrade path now.
Comment #16
plachThis was discussed a few days ago with @alexpott, @catch, @cilefen, @effulgentsia, @xjm and the entity and field system maintainers while triaging major issues. We agreed that this does not meet the criteria for a major bug, since there is a workaround for it: making the entity type revisionable while making field definitions revisionable. This is precisely what the Workflow initiative is aiming to do for core (see #2705389: Selected content entities should extend EditorialContentEntityBase or RevisionableContentEntityBase and #2721313: Upgrade path between revisionable / non-revisionable entities).
We agreed it would still be good to fix this as proposed.
Comment #26
quietone commentedUpdating tag.