Problem/Motivation

After update from 8.1.4 to 2.0.0 via composer I got that error in the status report. I made an database update and cleared all caches, but the error still exists. Any suggestions?

Steps to reproduce

Update the module from any 8.x-1.x

This does not happen for fresh installations

Proposed resolution

Add an update hook to install the schema - ONLY IF IT DOES NOT YET EXIST! (as the update hook will also affect fresh installations!)

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

Issue fork riddler-3313384

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

ab_connor created an issue. See original summary.

ab_connor’s picture

Issue summary: View changes
VValdo’s picture

Same issue. How to fix it?

anybody’s picture

Assigned: Unassigned » grevil

I can sadly confirm this. This does NOT happen for fresh installations of riddler, but only for updated, existing installations, as in this case Drupal doesn't maintain the schema change and it has to be done in an update hook.

Don't be afraid, everything should still work as expected, the next update will bring the schema fix.

This can be reproduced by installing riddler 8.x-1.x and then updating to 2.x.

Proposed solution:
Add an update hook to install the schema IF IT DOES NOT YET EXIST! (as the update hook will also affect fresh installations!)
See
https://www.drupal.org/docs/drupal-apis/update-api/updating-configuratio...

anybody’s picture

For details see:
https://www.drupal.org/node/2554097

I finally found a good and very similar example in this Geocoder issue: #3172255: Install new config entity type via update hook.
https://git.drupalcode.org/project/geocoder/-/commit/f745c0b1589b3c13a87...

We should DEFINITELY add documentation for this. Best would be if Drupal could provide a helper for this typical case...

anybody’s picture

anybody’s picture

Status: Active » Postponed

Let's wait if we get feedback for a better DX solution. Until that I'll mark the 8.x-1.x version supported and recommended again to not confuse further people, until this is fixed.

anybody’s picture

Version: 2.0.0 » 2.x-dev
anybody’s picture

Assigned: grevil » Unassigned
anybody’s picture

Issue summary: View changes

anybody’s picture

Assigned: Unassigned » grevil
Priority: Normal » Major
Status: Postponed » Needs review

Just had an idea how this might be solved cleanly. Please test and review (but please not in production environments!)

And please test for fresh 2.x installations and updated installations from 1.x

grevil’s picture

Status: Needs review » Reviewed & tested by the community

Works great! Tested it with a fresh Drupal installation, upgrading from 1.x to 2.x AND installing 2.x straight with another fresh Drupal installation. Also, I ran config inspector and no errors occurred!

I think I oversaw this issue, because somehow the entity was still registered for me, when upgrading because I did not use a fresh Drupal installation, to test the update hook originally.

  • Grevil committed eca28cc on 2.x authored by Anybody
    Issue #3313384: Error "Entity type riddle must be installed" after...
grevil’s picture

I set the default branch back to 2.x! Thanks for the heads-up @ab_connor!

grevil’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

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