Problem/Motivation
In the latest version of eu_cookie_category it was intruduced the CookieCategory entity, a game changer feature. With this feature, a hook_update was implemented, so existing sites could be properly migrated to the new data structure. Since I know is not the common scenario, in some situations is possible that the cookie category exist before the hook_update run, so the hook_update will fail. In such situation the update will fail and, in a automated deployment script, even the config import will trigger so there can be inconsistencies on the site.
A quick check would solve this issue ensuring the hook_update 8123 run with no issues.
Steps to reproduce
- Install and configure the eu_cookie_compilance module version 8.x-1.9
- Upgrade to 8.x-1.10 or upper (without running drush updb)
- Create a cookie category with the same name of one of yout configured categories
- Run drush updb
- You will get the following error:
> [notice] Update started: eu_cookie_compliance_update_8123 > [error] 'cookie_category' entity with ID 'mandatory' already exists. > [error] Update failed: eu_cookie_compliance_update_8123 [error] Update aborted by: eu_cookie_compliance_update_8123
Proposed resolution
Check if cookie category exist before crating it.
Remaining tasks
Fix hook_update 8123- Test & Review
User interface changes
None
API changes
None
Data model changes
None
Issue fork eu_cookie_compliance-3202724
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
akalam commentedComment #5
svenryen commentedComment #6
svenryen commentedThanks for the patch - merged!
Comment #7
akalam commentedThank you