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
Update 8013 fails when updating from old paragraphs version (system.schema is 8011):
Failed: Drupal\Core\Entity\EntityStorageException: Exception thrown while performing a schema update. MySQL needs the 'parent_type' field specification in order to normalize the 'paragraphs__parent_fields' index in Drupal\Core\Entity\Sql\SqlContentEntityStorage->wrapSchemaException() (line 1607 of core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php).
Proposed resolution
Add the code for updating the field storage definitions of the parent fields from paragraphs_update_8019 to paragraphs_update_8013.
Comment | File | Size | Author |
---|---|---|---|
#15 | paragraphs-update-error-3117998-15.patch | 207.39 KB | Berdir |
#15 | paragraphs-update-error-3117998-15-test-only.patch | 205.77 KB | Berdir |
#12 | paragraphs-update-error-3117998-12-interdiff.txt | 426 bytes | Berdir |
#12 | paragraphs-update-error-3117998-12.patch | 207.61 KB | Berdir |
#12 | paragraphs-update-error-3117998-12-test-only.patch | 205.98 KB | Berdir |
Comments
Comment #2
volkerk CreditAttribution: volkerk at Thunder commentedComment #3
volegerWorks for me.
Helped to perform an update from 8009 to 8023.
Comment #4
azovsky CreditAttribution: azovsky commentedUnfortunately this did not help me. Still have an error:
Comment #5
tamer.kamel CreditAttribution: tamer.kamel as a volunteer commentedYou need to run this
drush ev "drupal_set_installed_schema_version('paragraphs', 8009)"
to reset the hook update then it will work.Comment #6
themic8 CreditAttribution: themic8 at Michalak commentedThank you for the patch. This resolved my issue.
Comment #7
harpreet16 CreditAttribution: harpreet16 at Srijan | A Material+ Company for Drupal India Association commentedThis works. Follow comments in https://www.drupal.org/project/paragraphs/issues/3104561#comment-13568061
Tested with:
Drupal version: 8.8.5
Initial version of paragraphs installed: 8.x-1.0.0
Updated paragraph version: 8.x-1.11
Drush Commandline Tool: 9.7.1
Comment #8
SerShevchykDrupal core 8.8.5 and Paragraphs 8.x-1.11 I still have a message The paragraph.field field needs to be updated.
Comment #9
Cracu CreditAttribution: Cracu commentedIt seems that code from paragraphs_update_8010() needs to be executed again when upgrading.
To avoid any manual intervention in prod environments to reset schema for paragraphs or temporary code changes in contrib module, you could add a custom update hook for your custom profile or a custom module, then make sure that you implement hook_update_dependencies() where you enforce paragraphs_update_8017 to be executed before your custom code that re-executes code from paragraphs_update_8010().
This is a code workaround until a patch is submitted.
assuming that you have a custom profile called: my_profile, add these lines in my_profile.install
Comment #10
juankvillegas CreditAttribution: juankvillegas commented#2 worked for me.
Comment #11
BerdirSorry for the delay here. I didn't feel comfortable doing any more changes to the upgrade path without test coverage and finally managed to create an update path test, hopefully that will reduce the amount of problems like this in the future.
Comment #12
BerdirWrong namespace, that's why it didn't fail. Lets try that again testbot.
Comment #15
BerdirMaking stupid mistakes today. Obviously using 8.9 as the base isn't a good idea when running tests against 8.8.
Comment #18
BerdirNice, so now it only fails on postgresql, which is a known issue: #3081645: make paragraphs_post_update_rebuild_parent_fields() compatible with PostGreSQL dbs
Comment #20
vertigo093i CreditAttribution: vertigo093i commentedThe patch from #2 works fine for composer-based installs. The others don't because of binary patches are not supported by
patch
utility.