Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
We recently added behavior plugins to Paragraphs, unfortunately the serialized field where the values are stored is not revisionable and can create compatibility problems with diff module.
Proposed resolution
Make the field revisionable, since the field can be used already we need to provide an update function adding field tables manually.
Remaining tasks
User interface changes
API changes
Data model changes
Comment | File | Size | Author |
---|---|---|---|
#13 | make_the_behavior-2838657-13-interdiff.txt | 2.3 KB | Berdir |
#13 | make_the_behavior-2838657-13.patch | 1.49 KB | Berdir |
#9 | interdiff-2838657-7-9.txt | 783 bytes | johnchque |
#9 | make_the_behavior-2838657-9.patch | 2.11 KB | johnchque |
#7 | interdiff-2838657-2-7.txt | 589 bytes | johnchque |
Comments
Comment #2
johnchqueThis should work. :).
Comment #3
miro_dietikerLet's make sure we have this stuff connected.
Berdir pointed out that this update is not enough if data exists.
Comment #4
BerdirYes, the standard update functions don't work if there is data and they need to make altering changes.
If you run this with data in there then it will fail.
You need to make the schema changes by hand and then update the stored metadata. See poll.install for an example.
Or maybe we could delete the data and then do the update, but we need to migrate the data to the new storage, so getting it out first.
Comment #5
miro_dietikerI don't think anyone has data we need to migrate currently, so deleting the plugin storage column if already existing and recreating it would also be OK?
(Risk: If someone reruns this update method later accidentally, data is truly lost.)
Comment #6
BerdirI was thinking about that. If we do it before the next release, then yes, maybe. chances of someone already using this seem to be very small.
Then we could just do an update query to set the field to NULL, an then call that update, that should work. Make sure to test it with having data.
Comment #7
johnchqueNot sure if this is the way to make this update work. Wouldn't we instead drop everything related with the field and add it again?
Comment #9
johnchqueOops, sorry, didn't have to remove the field.
Comment #11
johnchqueTest-bot problem. :/
Comment #12
BerdirNope, that's not what I meant. I'll give it a try.
Comment #13
BerdirThis is, much simpler.
This is why we need to empty the data first, so we can get around the limitation of the API of not supporting changes if there is data. But it works perfectly if the column is empty.
Also noticed that we didn't had the default value of the field set to a serialized array, so new paragraphs created in the API or when nobody called setBehaviorSetting() were NULL.
Comment #14
BerdirComment #16
miro_dietikerCommitted.