Getting this error when trying to update:

google_analytics_counter module
Update #8009
Failed: Drupal\Core\Database\IntegrityConstraintViolationException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '2-1-0-en' for key 'PRIMARY': UPDATE {node__field_google_analytics_counter} SET deleted=:db_update_placeholder_0; Array ( [:db_update_placeholder_0] => 1 ) in Drupal\Core\Database\Connection->handleQueryException() (line 683 of /home///.com/core/lib/Drupal/Core/Database/Connection.php).

CommentFileSizeAuthor
#2 gac update.jpg40.98 KBtepelena

Comments

tepelena created an issue. See original summary.

tepelena’s picture

StatusFileSize
new40.98 KB
esod’s picture

Thanks, @tepelena. I'll look into it.

esod’s picture

The update does change the entity to an integer. I should have introduced the field as an integer instead of a textfield in the first place. So I'm trying to correct this mistake with the alpha15 update. I thought my code in update 8009 took care of the change, but obviously not.

I can't think of a reason why you're getting an integrity constraint violation in a delete. It's a delete after all. I will look into it further. You can try clearing cache before attempting to run the module update again.

To keep things moving for you and others who may be running into this same problem, try these manual steps:

  1. Delete the field through normal procedures or check the checkbox next to Remove the custom field on the Custom field tab (/admin/config/system/google-analytics-counter-configure-types) and click Save configuration.
  2. Update the module.
  3. Uncheck the Remove the custom field checkbox on the Custom field tab and check the content types you would like to add the custom field to.
  4. Click Save configuration.
  5. Run cron.

After cron, your data will be restored and you can use the field the same way you've been using it, except now the field is an integer instead of a text field. So views will work better if you sort by the custom field.

esod’s picture

I found the problem. I never tested alpha15 with the custom field on more than one content type. That's probably where the integrity constraint violation is coming from.

If you can wait a few minutes, I'll have to cut an alpha16 tag for the regression. Otherwise, my recommendations in #4 will always work.

  • esod committed 71f59bd on 3027334-unable-to-update-to-latest-release
    Issue #3027334 by tepelena, esod: Initial commit. Needs testing.
    
tepelena’s picture

Thank you for the update. I will wait for the alpha16.

Right now the site works, but I can't complete the update.

Thank you so much for looking into this.

  • esod committed 7cde60d on 3027334-unable-to-update-to-latest-release
    Issue #3027334 by esod: More work.
    
tepelena’s picture

Under /admin/config/system/google-analytics-counter-configure-types
I unchecked all Content Types

run update.php

It went through without any issues.

Thanks

esod’s picture

Hi @tapelena. Great. The update 8009 has other problems. I'm fixing it.

  • esod committed 6404106 on 3027334-unable-to-update-to-latest-release
    Issue #3027334 by esod: Match the gac_type with the content_type id.
    

  • esod committed 98e0e6e on 3027334-unable-to-update-to-latest-release
    Issue #3027334 by tepelena, esod: Unable to Update to latest release
    

  • esod committed 6404106 on 8.x-3.x
    Issue #3027334 by esod: Match the gac_type with the content_type id.
    
  • esod committed 71f59bd on 8.x-3.x
    Issue #3027334 by tepelena, esod: Initial commit. Needs testing.
    
  • esod committed 7cde60d on 8.x-3.x
    Issue #3027334 by esod: More work.
    
  • esod committed 98e0e6e on 8.x-3.x
    Issue #3027334 by tepelena, esod: Unable to Update to latest release
    
esod’s picture

Okay it should be better now with alpha16. I hope you get the attribution for this bug. Your issues are really helpful. Thanks again.

tepelena’s picture

The latest update went smoothly. Thanks.

tepelena’s picture

Status: Active » Reviewed & tested by the community
kaszarobert’s picture

Status: Reviewed & tested by the community » Fixed

Fixing status if it's done.

Status: Fixed » Closed (fixed)

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