Problem/Motivation
Error in update hook prevents from updating from version 1.0.0-rc1 to 1.0.0-rc2.
Steps to reproduce
- Install the module ver. 1.0.0-rc1
- Add some fields of type Entity Reference Media with some content.
- Update to version 1.0.0-rc2
- Run drush updb, there will be an error:

I'm not sure, but maybe the error is related to paragraph's fields only.
Proposed resolution
Check if field already exists on update(?).
Remaining tasks
Fix the update hook's code.
User interface changes
API changes
Data model changes
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | erm_fix_update_3264280.patch | 1.27 KB | granik |
| Screenshot from 2022-02-07 16-28-29.png | 29.87 KB | granik |
Comments
Comment #2
grienauerComment #3
dejan0 commentedyes, an update hook is provided here: https://www.drupal.org/project/entity_reference_media/issues/3206403
and it makes sense only when updates from the very first version to rc2.
Fields are already there in rc1, that's why the update hook doesn't work in this case.
This idea sounds good, I think
Comment #4
grienauerPatch is welcome ;P
Comment #5
granikAdded a patch. Now there is a check if field already exists.
Comment #6
dejan0 commented@Granik Looks very good, thanks!
Comment #7
dejan0 commented