Problem/Motivation

On a clean install of the v3 Editorially module, at the point that any entity is deleted the site generates a fatal error:

Drupal\Core\Entity\EntityStorageException: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'entity_id' in 'where clause': DELETE FROM "editoria11y_dismissals" WHERE ("entity_id" = :db_condition_placeholder_0)

This is because the function editoria11y_dismissals_table() does not include an entity_id column. This was added later in editoria11y_update_9004(): on a clean install of the module (as opposed to an update from an earlier version) the update hooks aren't run, and so the database created for the module has an incorrect schema.

Steps to reproduce

Install v3 of the Editorially module on a site that has not has any version of the module installed before. Check the database tables created by Drupal for the module: they do not contain an entity_id column.

Proposed resolution

The schema for all tables should be updated to include any tables and columns added later in update hooks, and an additional update hook added to rerun the required update hooks added to accommodate anyone already affected by this bug.

Comments

mrdalesmith created an issue. See original summary.

itmaybejj’s picture

Thank you for the testing. I'll work on this.

...you...are just testing,right? V3 is not ready or use in production yet; the schema is not yet decided and there will not be update hooks between alphas.

mrdalesmith’s picture

Just testing :)

itmaybejj’s picture

Fantastic. Thanks for the help then.

I'm planning to go back to the drawing board on some of these update hooks -- one of the other maintainers pointed out that at the scale of changes I need to make this time I'd be less crash prone if I just made new tables and copied over values rather than try to force schema changes in place. That should address this problem too.

itmaybejj’s picture

Status: Active » Fixed

I think this is resolved in the 3.x dev branch.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

itmaybejj’s picture

Status: Fixed » Needs work
itmaybejj’s picture

pfft no it's not

  • itmaybejj committed 0082e685 on 3.0.x-dev
    feat: #3560068 Database Schema out of date
    
    By: mrdalesmith
    By:...
itmaybejj’s picture

Status: Needs work » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

  • itmaybejj committed 0082e685 on 3.0.x
    feat: #3560068 Database Schema out of date
    
    By: mrdalesmith
    By:...

Status: Fixed » Closed (fixed)

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