Problem/Motivation
When we added the parent fields, we didn't expect that paragraphs are moved around and that that information could change between revisions.
But with new features like drag & drop and library, this can actually happen and then the old revisions would also have the new parent, which might break access and other things when looking at old revisions and other, worse problems.
Proposed resolution
Make the fields revisionable, write an update function that creates the revisionable storage and adds the value to the old revisions.
Remaining tasks
User interface changes
API changes
Data model changes
Comments
Comment #2
johnchqueWorking on this.
Comment #3
johnchqueSeems to fall when having translation, will keep testing.
Comment #5
johnchqueTested again many times, it seems this is not the right way to follow. The revisions are all null and we just get one revision of each paragraph after running the updates.
Comment #7
johnchqueOK, first working version. Haven't thrown any warning/error and the fields seem to be updated accordingly. :)
Comment #9
johnchqueStrange, one of the test that fails is passing locally. Testing again.
Comment #11
johnchquePretty strange, tried with multiple versions of EB and they pass locally. Adding some debugs to see the page content and see what is happening.
Comment #13
johnchqueLet's fix these tests :) :)
Comment #15
johnchqueTrying once again.
Comment #16
johnchqueSorry, the patch included fixes for tests that will be done in #3026890: Update to Entity Browser 8.x-2.x in tests. :)
Comment #18
johnchqueComment #19
berdirI think we could put this stuff in a loop for the 3 fields.
We could check if https://www.drupal.org/project/drupal/issues/2984782 makes this easier, but then we have to add a dependency on 8.7 for this and wait until May or so.
Comment #20
berdirTested the patch on a site with 800k paragraphs, took about 2min, that is better than I expected.
However, drush entup still reports that those fields need to be changed, which means that something has not been properly updated yet.
Comment #21
berdirComment #22
berdirWhat's failing is this check "$storage_definition->isRevisionable() != $original->isRevisionable()" in "\Drupal\Core\Entity\Sql\SqlContentEntityStorageSchema::requiresFieldStorageSchemaChanges", $original still says revisionable FALSE.
The code that we have should fix that, but it looks like something doesn't work.
Comment #23
johnchque@Berdir was right! We added complexity by trying to do everything at once. This should work better. :)
Comment #24
johnchqueThis should be included too.
Comment #25
johnchqueRefactoring the code thanks to @Berdir. This should work better. :)
Comment #26
johnchqueHmmm, it seems they had different limits.
Comment #27
johnchqueWhile testing with many paragraphs I found out that this was missing.
Comment #28
berdirWe are processing paragraphs, not nodes ;)
Can be fixed on commit, this seems to be working well, also on very large installations.
Comment #30
miro_dietikerCommitted while fixing the string.