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

Created on 17 May 2018, over 6 years ago
Updated 7 September 2024, 4 months ago

So I'm trying to follow the upgrade path instructions and when I get to the point of doing #8 (DB updates), it says:

In order to run the Media Entity 2.x upgrade, please uninstall and remove from the codebase the contributed "Media" module.

But I have removed the contrib media module. That part of the upgrade check uses moduleExists, which I guess is picking up the core media module now?

Then I'm also getting missing column error whenever I try to do something on the site:

The website encountered an unexpected error. Please try again later.</br></br><em class="placeholder">Drupal\Core\Database\DatabaseExceptionWrapper</em>: SQLSTATE[42S22]: Column not found: 1054 Unknown column &#039;revision.revision_user&#039; in &#039;field list&#039;: SELECT revision.vid AS vid, revision.langcode AS langcode, revision.revision_user AS revision_user, revision.revision_created AS revision_created, revision.revision_log_message AS revision_log_message, revision.revision_default AS revision_default, base.mid AS mid, base.bundle AS bundle, base.uuid AS uuid, CASE base.vid WHEN revision.vid THEN 1 ELSE 0 END AS isDefaultRevision
FROM 
{media} base
INNER JOIN {media_revision} revision ON revision.vid = base.vid
WHERE base.mid IN (:db_condition_placeholder_0); Array
(
    [:db_condition_placeholder_0] =&gt; 1187
)
 in <em class="placeholder">Drupal\Core\Entity\Sql\SqlContentEntityStorage-&gt;getFromStorage()</em> (line <em class="placeholder">455</em> of <em class="placeholder">core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php</em>). <pre class="backtrace">Drupal\Core\Database\Statement-&gt;execute(Array, Array) (Line: 625)
Drupal\Core\Database\Connection-&gt;query(&#039;SELECT revision.vid AS vid, revision.langcode AS langcode, revision.revision_user AS revision_user, revision.revision_created AS revision_created, revision.revision_log_message AS revision_log_message, revision.revision_default AS revision_default, base.mid AS mid, base.bundle AS bundle, base.uuid AS uuid, CASE base.vid WHEN revision.vid THEN 1 ELSE 0 END AS isDefaultRevision
FROM 
{media} base
INNER JOIN {media_revision} revision ON revision.vid = base.vid
WHERE base.mid IN (:db_condition_placeholder_0)&#039;, Array, Array) (Line: 87)
Drupal\Core\Database\Driver\mysql\Connection-&gt;query(&#039;SELECT revision.vid AS vid, revision.langcode AS langcode, revision.revision_user AS revision_user, revision.revision_created AS revision_created, revision.revision_log_message AS revision_log_message, revision.revision_default AS revision_default, base.mid AS mid, base.bundle AS bundle, base.uuid AS uuid, CASE base.vid WHEN revision.vid THEN 1 ELSE 0 END AS isDefaultRevision
FROM 
{media} base
INNER JOIN {media_revision} revision ON revision.vid = base.vid
WHERE base.mid IN (:db_condition_placeholder_0)&#039;, Array, Array) (Line: 510)
Drupal\Core\Database\Query\Select-&gt;execute() (Line: 455)
Drupal\Core\Entity\Sql\SqlContentEntityStorage-&gt;getFromStorage(Array) (Line: 426)
Drupal\Core\Entity\Sql\SqlContentEntityStorage-&gt;doLoadMultiple(Array) (Line: 242)
Drupal\Core\Entity\EntityStorageBase-&gt;loadMultiple(Array) (Line: 212)
Drupal\Core\Entity\EntityStorageBase-&gt;load(&#039;1187&#039;) (Line: 524)
Drupal\Core\Entity\Entity::load(&#039;1187&#039;) (Line: 38)
Drupal\aao_additions\Plugin\Field\FieldFormatter\AAOImageFormatter-&gt;viewElements(Object, &#039;en&#039;) (Line: 80)
Drupal\Core\Field\FormatterBase-&gt;view(Object, NULL) (Line: 262)
Drupal\Core\Entity\Entity\EntityViewDisplay-&gt;buildMultiple(Array) (Line: 321)
Drupal\Core\Entity\EntityViewBuilder-&gt;buildComponents(Array, Array, Array, &#039;full&#039;) (Line: 22)
Drupal\node\NodeViewBuilder-&gt;buildComponents(Array, Array, Array, &#039;full&#039;) (Line: 263)
Drupal\Core\Entity\EntityViewBuilder-&gt;buildMultiple(Array) (Line: 220)
Drupal\Core\Entity\EntityViewBuilder-&gt;build(Array)
call_user_func(Array, Array) (Line: 378)
Drupal\Core\Render\Renderer-&gt;doRender(Array, ) (Line: 195)
Drupal\Core\Render\Renderer-&gt;render(Array, ) (Line: 226)
Drupal\Core\Render\MainContent\HtmlRenderer-&gt;Drupal\Core\Render\MainContent\{closure}() (Line: 582)
Drupal\Core\Render\Renderer-&gt;executeInRenderContext(Object, Object) (Line: 227)
Drupal\Core\Render\MainContent\HtmlRenderer-&gt;prepare(Array, Object, Object) (Line: 117)
Drupal\Core\Render\MainContent\HtmlRenderer-&gt;renderResponse(Array, Object, Object) (Line: 90)
Drupal\Core\EventSubscriber\MainContentViewSubscriber-&gt;onViewRenderArray(Object, &#039;kernel.view&#039;, Object)
call_user_func(Array, Object, &#039;kernel.view&#039;, Object) (Line: 111)
Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher-&gt;dispatch(&#039;kernel.view&#039;, Object) (Line: 156)
Symfony\Component\HttpKernel\HttpKernel-&gt;handleRaw(Object, 1) (Line: 68)
Symfony\Component\HttpKernel\HttpKernel-&gt;handle(Object, 1, 1) (Line: 57)
Drupal\Core\StackMiddleware\Session-&gt;handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\KernelPreHandle-&gt;handle(Object, 1, 1) (Line: 99)
Drupal\page_cache\StackMiddleware\PageCache-&gt;pass(Object, 1, 1) (Line: 78)
Drupal\page_cache\StackMiddleware\PageCache-&gt;handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware-&gt;handle(Object, 1, 1) (Line: 50)
Drupal\Core\StackMiddleware\NegotiationMiddleware-&gt;handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel-&gt;handle(Object, 1, 1) (Line: 664)
Drupal\Core\DrupalKernel-&gt;handle(Object) (Line: 19)
</pre>

I tried running entity-updates and it says it can't make the changes with data in the table:

<pre>
$ ../vendor/bin/drush entity-updates
The following updates are pending:

media entity type :
  The Media entity type needs to be updated.
  The Revision create time field needs to be installed.
  The Revision user field needs to be installed.
  The Revision log message field needs to be installed.
  The Revision timestamp field needs to be uninstalled.
  The Revision publisher ID field needs to be uninstalled.
  The Revision Log field needs to be uninstalled.
media_type entity type :
  The Media type entity type needs to be installed.
Do you wish to run all pending updates? (y/n): y
Drupal\Core\Entity\EntityStorageException: The SQL storage cannot    [error]
change the schema for an existing entity type (media) with data. in
Drupal\Core\Entity\Sql\SqlContentEntityStorageSchema->onEntityTypeUpdate()
(line 347 of
/Users/jason/Sites/artobject/web/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php).
Failed: Drupal\Core\Entity\EntityStorageException: !message in       [error]
Drupal\Core\Entity\Sql\SqlContentEntityStorageSchema-&gt;onEntityTypeUpdate()
(line 347 of
/Users/jason/Sites/artobject/web/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php).
Cache rebuild complete.                                              [ok]
Finished performing updates.                                         [ok]
</pre>
πŸ’¬ Support request
Status

Postponed: needs info

Version

11.0 πŸ”₯

Component
MediaΒ  β†’

Last updated about 7 hours ago

Created by

πŸ‡ΊπŸ‡ΈUnited States jason_purdy

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.

  • πŸ‡³πŸ‡ΏNew Zealand quietone

    There has been no discussion on the support request for 4 years suggesting that solutions have been found. And I don't see discussion that this is a core bug. I think it is time to close this.

    The Drupal Core issue queue is not the ideal place for support requests (that option is mostly there for filing support issues for contributed modules and themes). There are several support options listed on our support page β†’ (Community > Support at the top of Drupal.org) and there is Drupal Slack β†’ . Drupal Slack and the Forums, which are our two main support mechanisms in the Drupal community.

Production build 0.71.5 2024