The SQL storage cannot change the schema for an existing entity type (node) with data

Created on 29 March 2018, over 6 years ago
Updated 29 January 2024, 11 months ago

Hi all,

When updating from 8.4.5 to 8.5.1 I have this error (on 4 different sites):

system-module
#8501 bijwerken
Mislukt: Drupal\Core\Entity\EntityStorageException: The SQL storage cannot change the schema for an existing entity type (node) with data. in Drupal\Core\Entity\Sql\SqlContentEntityStorageSchema->onEntityTypeUpdate() (regel 347 van /home/oms/domains/domain.nl/public_html/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php).

What can I do to fix this?

Thanks,
Rolf

🐛 Bug report
Status

Closed: duplicate

Version

8.6 ⚰️

Component
Entity 

Last updated about 2 hours ago

Created by

🇳🇱Netherlands BlinX

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇮🇳India mrunwal

    I have upgraded Drupal 8.8 to 9.5.2
    php 8.1

    I am still facing same issue. is there alternate way to fix it either manually by checking db tables to fix it ?

  • I have recently installed Drupal 10 on my website, and I am also receiving similar errors as follows;
    >>
    Mismatched entity and/or field definitions
    The following changes were detected in the entity type and field definitions.
    Media type
    The Media type entity type needs to be installed.
    Media
    The Media entity type needs to be installed.
    >>

  • 🇳🇱Netherlands mariskath

    I'm having the same problem.
    On my status report it says:
    "Entity/field definitions
    Mismatched entity and/or field definitions
    The following changes were detected in the entity type and field definitions.
    Media
    The Media entity type needs to be installed.
    Media type
    The Media type entity type needs to be installed."

    The media module is part of core and enabled.

    When I go to 'uninstall', I get the following errors. Striking is that ' media' is mentioned again, so I think it is related:

    The website encountered an unexpected error. Please try again later.

    Drupal\Core\Database\DatabaseExceptionWrapper: SQLSTATE[42S02]: Base table or view not found: 1146 Table '4tuethics.media' doesn't exist: SELECT "base_table"."vid" AS "vid", "base_table"."mid" AS "mid" FROM "media" "base_table" GROUP BY "base_table"."vid", "base_table"."mid" LIMIT 1 OFFSET 0; Array ( ) in Drupal\Core\Entity\Query\Sql\Query->result() (line 271 of core\lib\Drupal\Core\Entity\Query\Sql\Query.php).

    Drupal\Core\Database\StatementWrapperIterator->execute(Array, Array) (Line: 790)
    Drupal\Core\Database\Connection->query('SELECT "base_table"."vid" AS "vid", "base_table"."mid" AS "mid"
    FROM
    {media} "base_table"
    GROUP BY "base_table"."vid", "base_table"."mid"
    LIMIT 1 OFFSET 0', Array, Array) (Line: 525)
    Drupal\Core\Database\Query\Select->execute() (Line: 271)
    Drupal\Core\Entity\Query\Sql\Query->result() (Line: 84)
    Drupal\Core\Entity\Query\Sql\Query->execute() (Line: 617)
    Drupal\Core\Entity\EntityStorageBase->hasData() (Line: 43)
    Drupal\Core\Entity\ContentUninstallValidator->validate('media') (Line: 624)
    Drupal\Core\Extension\ModuleInstaller->validateUninstall(Array) (Line: 99)
    Drupal\Core\ProxyClass\Extension\ModuleInstaller->validateUninstall(Array) (Line: 161)
    Drupal\system\Form\ModulesUninstallForm->buildForm(Array, Object)
    call_user_func_array(Array, Array) (Line: 536)
    Drupal\Core\Form\FormBuilder->retrieveForm('system_modules_uninstall', Object) (Line: 283)
    Drupal\Core\Form\FormBuilder->buildForm(Object, Object) (Line: 73)
    Drupal\Core\Controller\FormController->getContentResult(Object, Object)
    call_user_func_array(Array, Array) (Line: 123)
    Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 583)
    Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 121)
    Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
    Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 166)
    Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 74)
    Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 58)
    Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48)
    Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 106)
    Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
    Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 48)
    Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 51)
    Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 51)
    Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object, 1, 1) (Line: 704)
    Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

    Best regards,
    Mariska

  • 🇳🇱Netherlands mariskath

    I have run into this problem multiple times now.

    The patch in #57 of this thread works for me. https://www.drupal.org/project/drupal/issues/2563515 🐛 Improperly deployed *missing* entity table breaks module uninstall Needs work

    Best regards,
    Mariska

Production build 0.71.5 2024