Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
Given that we do have a module with custom block type config
When we update the current Drupal 8 site to 8.3.x
And we enable the module which create new block types
And we go to "/admin/reports/status"
Then we will see the following:
Errors found
ENTITY/FIELD DEFINITIONS
Mismatched entity and/or field definitions
The following changes were detected in the entity type and field definitions.
Custom block
The Translation source field needs to be installed.
The Translation outdated field needs to be installed.
The Translation author field needs to be installed.
The Translation status field needs to be installed.
The Translation created time field needs to be installed.
When we try create a custom block from that Block type
Then It will not work
And we get some of the following errors in the log:
[Tue May 16 12:02:35.044450 2017] [:error] [pid 21174] [client 127.0.0.1:59294] Uncaught PHP Exception Drupal\\Core\\Entity\\EntityStorageException: "SQLSTATE[42S22]: Column not found: 1054 Unknown column 'content_translation_source' in 'field list': INSERT INTO {block_content_field_data} (id, revision_id, type, langcode, info, changed, revision_created, revision_user, revision_translation_affected, default_langcode, content_translation_source, content_translation_outdated, content_translation_uid, content_translation_status, content_translation_created) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5, :db_insert_placeholder_6, :db_insert_placeholder_7, :db_insert_placeholder_8, :db_insert_placeholder_9, :db_insert_placeholder_10, :db_insert_placeholder_11, :db_insert_placeholder_12, :db_insert_placeholder_13, :db_insert_placeholder_14); Array\n(\n [:db_insert_placeholder_0] => 2\n [:db_insert_placeholder_1] => 2\n [:db_insert_placeholder_2] => test_block\n [:db_insert_placeholder_3] => en\n [:db_insert_placeholder_4] => Homepage carousel\n [:db_insert_placeholder_5] => 1494925354\n [:db_insert_placeholder_6] => 1494925354\n [:db_insert_placeholder_7] => 1\n [:db_insert_placeholder_8] => 1\n [:db_insert_placeholder_9] => 1\n [:db_insert_placeholder_10] => und\n [:db_insert_placeholder_11] => 0\n [:db_insert_placeholder_12] => 1\n [:db_insert_placeholder_13] => 1\n [:db_insert_placeholder_14] => 1494925303\n)\n" at /var/www/html/dev/drupal0803/docroot/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php line 777, referer: http://localhost/dev/drupal0803/docroot/block/add/test_block?destination=/dev/drupal0803/docroot/admin/structure/block/block-content
Proposed resolution
Manual fix:
drush entity-updates
The following updates are pending:
block_content entity type :
The Translation source field needs to be installed.
The Translation outdated field needs to be installed.
The Translation author field needs to be installed.
The Translation status field needs to be installed.
The Translation created time field needs to be installed.
Do you wish to run all pending updates? (y/n):
Automated fix: with every update in the late stages of updates.
// Entity updates to clear up any mismatched entity and/or field definitions
// And Fix changes were detected in the entity type and field definitions.
\Drupal::entityDefinitionUpdateManager()->applyUpdates();
Remaining tasks
Automate the fix, if that is the right direction
Comments
Comment #2
Rajab Natshah CreditAttribution: Rajab Natshah at Vardot commentedComment #5
borisson_Setting to active, as there is no patch to review.
Comment #9
szato CreditAttribution: szato at Brainsum commentedI've run into the same issue.
Adding code to the hook_update_N() fixed my probleme: