Problem/Motivation
The primary goal of the Workflow Initiative is to make most core entity types revisionable and publishable so they can be used in the context of Content Moderation, Workspaces, full-site previews, etc.
There is a long chain of issues that is trying to accomplish this, with the end result being that an entity type can be converted to revisionable (with revision metadata fields) and publishable in a minor Drupal core version (i.e. in 8.4.0)
Proposed resolution
Before we start converting entity types we need to be sure that we can actually do all these updates at once.
Remaining tasks
Have a green patch in this issue.
Also, this issue has the following dependencies:
#2721313: Upgrade path between revisionable / non-revisionable entities
#2856808: Break out the 'entity_test_update' entity type into its own module and add additional test db dumps
#2615496: A serial/primary key field can not be added to an existing table for some databases
#2346019: Handle initial values when creating a new field storage definition
#2854732: Use initial values for content translation metadata fields and fix existing data
User interface changes
Nope.
API changes
Field storage CRUD operations will now use the last installed entity type and field storage definitions.
Data model changes
Nope.
| Comment | File | Size | Author |
|---|---|---|---|
| #30 | interdiff.txt | 4 KB | amateescu |
| #30 | 2860654-30.patch | 21.76 KB | amateescu |
| #27 | interdiff.txt | 1.21 KB | amateescu |
| #27 | 2860654-27.patch | 21.5 KB | amateescu |
| #25 | 2860654-25.patch | 21.52 KB | amateescu |
Comments
Comment #2
amateescu commentedHere's an initial patch.
Comment #3
amateescu commentedAnd one combined with all the dependencies.
Comment #6
jibran#2615496: A serial/primary key field can not be added to an existing table for some databases is in.
Comment #7
jibran#2856808: Break out the 'entity_test_update' entity type into its own module and add additional test db dumps is also fixed.
Comment #8
amateescu commented#2721313: Upgrade path between revisionable / non-revisionable entities was committed!!
Comment #9
amateescu commentedWe now depend only on #2346019: Handle initial values when creating a new field storage definition and #2854732: Use initial values for content translation metadata fields and fix existing data, so I got back to this issue and we finally have a good (and properly tested) way for making an entity type publishable and revisionable!
Comment #11
amateescu commentedThe interdiff in #9 tried to fix all field storage operations (create, update, delete) but I quickly ended up in a can of worms because the entity update system is pretty much broken in regards to the correct usage of last installed definitions vs. actual runtime definitions of field storages and entity types.
So I scaled back the fix to only include the parts that we need for the scope of this issue, which is making sure that we can convert and entity type to be revisionable and add a published base field at the same time.
Note that this also includes @tstoeckler's fix for #2346019-49: Handle initial values when creating a new field storage definition, and I tried to keep the ugliness contained into a single place (
\Drupal\Core\Entity\Sql\SqlContentEntityStorageSchema::onFieldStorageDefinitionCreate).Comment #13
amateescu commentedOk then, let's try this.
Comment #15
amateescu commentedFingers crossed :D
Comment #16
amateescu commentedRemoved a dependency which is no longer necessary from the IS.
Comment #19
amateescu commentedMeh..
Comment #20
jibranIf this issue is test only then why not postpone it on #2274017: Make SqlContentEntityStorage table mapping agnostic ?
Comment #21
amateescu commentedBecause this issue is not test only, it's more like "do everything needed before we can convert entity types to revisionable and publishable" :)
Meanwhile, I've been working on the next patch in line and I realized that there are a lot of other field updates that will break if we don't use the last installed entity type definition in field storage CUD operations, so we need to go back to the initial approach from #11.
Comment #22
amateescu commentedOne of the blocking issues is in, just one more to go :)
Comment #23
amateescu commentedChanging the title to show what this issue is actually about.
Comment #24
tstoecklerHehe, looks like you found #2884894: Remove obsolete + duplicate EntityTestUpdate class before me in #21. I don't mind doing this here but in any case we should also remove
entity_test_entity_field_storage_info()together with the obsolete entity type. So up to you whether we close that one as a dupe or extract that part to there...Comment #25
amateescu commented@tstoeckler, very good point about
entity_test_entity_field_storage_info(), and thanks for the separate issue, I moved over the deletion of the duplicateEntityTestUpdateclass there so we can keep this patch focused on the problem described in the issue title.#2854732: Use initial values for content translation metadata fields and fix existing data is in so this is now the last blocker for being able to convert entity types to revisionable and publishable! :D
Comment #26
timmillwoodLooks like we're ready to go!
Comment #27
amateescu commentedJust a couple of cosmetic fixes to match what we did in the previous (blocker) issues.
Also, I'd love to have @plach and/or @effulgentsia in here for a quick sanity check of this patch.. :)
Comment #28
wim leersEpic, epic work, @amateescu, @timmillwood and other Workflow Initiative contributors!
Comment #29
plachLooks great to me, a few minor remarks:
Shouldn't we clone
$storageto ensure the switch doesn't leak into other areas and causes unintended behaviors?Isn't this deprecated?
Comment #30
amateescu commentedThanks @plach, fixed both points from #29 :)
Comment #31
plachRTBC +1, thanks
Comment #32
catchCommitted/pushed to 8.4.x, thanks!
Comment #34
plach:)