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

Command icon 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

akalam created an issue. See original summary.

akalam’s picture

Issue summary: View changes
Status: Active » Needs review

  • svenryen committed 2ae0137 on 8.x-1.x
    Merge remote-tracking branch '3202724/3202724-1.x-...
  • akalam committed 799481f on 8.x-1.x
    Issue #3202724: [1.x] eu_cookie_compliance_update_8123 is triggering a...
svenryen’s picture

Status: Needs review » Reviewed & tested by the community
svenryen’s picture

Status: Reviewed & tested by the community » Fixed

Thanks for the patch - merged!

akalam’s picture

Thank you

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.