Problem/Motivation
If you are in the situation, that you want to migrate from contribs media_entity to Drupal core media entities and also want to update from Simple Sitemap 2.x to 3.x, the update command will fail.
The reason is, that the media_entity_update_8201() function deletes automatically created media types. Those deletes trigger simple_sitemap_entity_delete(), which in turn wants to delete entries from 'simple_sitemap_entity_overrides'. This fails, because simple_sitemap updates have not been executed yet, and the table schema is wrong.
Proposed resolution
Implement hook_update_dependencies() and make media_entity update 8201 depend on dimple_sitemap update 8216 (the one who adds the type field to the simple_sitemap_entity_overrides table.
Comment | File | Size | Author |
---|---|---|---|
#9 | 3062747-8.patch | 2.4 KB | alexpott |
| |||
#9 | 7-8-interdiff.txt | 803 bytes | alexpott |
#7 | 3062747-7.patch | 2.23 KB | alexpott |
| |||
#4 | 3062747-4.patch | 689 bytes | daniel.bosen |
|
Comments
Comment #2
gbyte CreditAttribution: gbyte as a volunteer and at gbyte commentedThanks for the report, I will be happy to commit a patch if you care to test and submit it.
Comment #3
gbyte CreditAttribution: gbyte as a volunteer and at gbyte commentedComment #4
daniel.bosenThat's the patch, that works for us.
Comment #5
gbyte CreditAttribution: gbyte as a volunteer and at gbyte commentedComment #6
alexpottI think we can do better here. The problem is that these hooks are also fired on config entity delete but simple_sitemap is not at all interested in these entities as far as I can see. See \Drupal\simple_sitemap\EntityHelper::getSupportedEntityTypes().
Comment #7
alexpottSomething like this should work and make Simple Sitemap more resilient during the update path.
Comment #8
daniel.bosenThis patch also works. And it is the better approach. Simple Sitemap now only processes entities, that are relevant. And messing with the update dependencies should be avoided, if possible.
Comment #9
alexpottSome indentation issues.
Comment #11
gbyte CreditAttribution: gbyte as a volunteer and at gbyte commented@alexpott I like that. Thanks to both of you.