0

I have no idea how to fix this, I don't even understand what the problem is.

Mismatched entity and/or field definitions
The following changes were detected in the entity type and field definitions.
Taxonomy term

The Term ID field needs to be installed.
The UUID field needs to be installed.
The Language field needs to be installed.
The Vocabulary field needs to be installed.
The Name field needs to be installed.
The Description field needs to be installed.
The Weight field needs to be installed.
The Term Parents field needs to be installed.
The Changed field needs to be installed.
The Default translation field needs to be installed.
The taxonomy_term.field_icon field needs to be installed.
The taxonomy_term.field_link field needs to be installed.
The taxonomy_term.field_meta_tags field needs to be installed.

enter image description here

I tried drush entity-updates but it finishes on error:

Character set 'utf8mb4' is not a compiled character set and is not specified 
in the '/usr/share/mysql/charsets/Index.xml' file
PHP Parse error:  syntax error, unexpected 'class' (T_CLASS), expecting identifier (T_STRING) or variable (T_VARIABLE) or '{' or '$' in /var/www/vhosts/mysite/httpdocs/core/lib/Drupal/Component/Serialization/Yaml.php on line 54
Drush command terminated abnormally due to an unrecoverable error.   [error]
Error: syntax error, unexpected 'class' (T_CLASS), expecting
identifier (T_STRING) or variable (T_VARIABLE) or '{' or '$' in
/var/www/vhosts/mysite/httpdocs/core/lib/Drupal/Component/Serialization/Yaml.php,
line 54

EDITED (after fixing drush install) I get the following for drush entity-updates

-sh-4.1$ drush entity-updates
The following updates are pending:

taxonomy_term entity type :
  The UUID field needs to be installed.
  The Language field needs to be installed.
  The Vocabulary field needs to be installed.
  The Name field needs to be installed.
  The Description field needs to be installed.
  The Weight field needs to be installed.
  The Term Parents field needs to be installed.
  The Changed field needs to be installed.
  The Default translation field needs to be installed.
  The taxonomy_term.field_icon field needs to be installed.
  The taxonomy_term.field_link field needs to be installed.
  The taxonomy_term.field_meta_tags field needs to be installed.
Do you wish to run all pending updates? (y/n): y
Drupal\Core\Entity\EntityStorageException: Exception thrown while performing a schema update. Cannot add unique key                              [error]
taxonomy_term_field__uuid__value to table taxonomy_term_data: unique key already exists. in
Drupal\Core\Entity\Sql\SqlContentEntityStorage->wrapSchemaException() (line 1470 of
/var/www/vhosts/mysite/httpdocs/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php).
Failed: Drupal\Core\Entity\EntityStorageException: !message in Drupal\Core\Entity\Sql\SqlContentEntityStorage->wrapSchemaException() (line    [error]
1470 of /var/www/vhosts/mysite/httpdocs/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php).
Cache rebuild complete.                                                                                                                          [ok]
Finished performing updates.

The bizarre thing is that all these things (field_icon, link, meta_tags..) are installed.

The site has many modules (both custom and from the drupal community) and it works alright. Should I export it all and do a clean install and then import it?


UPDATE

I did not manage to fix this and it was giving very weird problems out of the blue, although the already created content types and nodes worked fine. After 24h+ of non stop working I reset the stype up from a clean install and copied content manually (tried doing the Configuration > Configuration synchronization with single items, but it didn't work very well).

I can report now that the problem is gone. I have no idea what could have caused it or even when.

4
  • 3
    There seem to be a few things very wrong. Apparently the PHP version that you have with drush is too old. And you don't have the utf8mb4 character set in MySQL that drupal needs. Try to figure out those problems first. But something went very, very badly with that site. – Berdir Dec 1 '16 at 20:47
  • You are right, I fixed the problem and drush was able to execute a whole lot better, mind helping me out with the new error messages? – Chayemor Dec 1 '16 at 23:17
  • This happens all the time (to me). – Kevin Dec 3 '16 at 16:17
  • @Kevin , you mean the 'mismatched' error with the Taxonomy terms? – Chayemor Dec 3 '16 at 16:30
0

I got the above errors but with the node table. I am not sure if this is a safe thing to do but I executed the following MySQL command at the prompt:

ALTER TABLE node DROP INDEX node_field__uuid__value;

After that the entity updates executed without any problem.

For the author's problem I suppose you could adapt the command to:

ALTER TABLE taxonomy_term_data DROP INDEX taxonomy_term_field__uuid__value;

The key should be generated the next time you run that entity updates Drush command.

0

I had the same problem. The table structure changed. It was:

CREATE TABLE `taxonomy_term_data` (
    `tid` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
    `vid` VARCHAR(32) NOT NULL COMMENT 'The ID of the target entity.' COLLATE 'ascii_general_ci',
    `uuid` VARCHAR(128) NOT NULL COLLATE 'ascii_general_ci',
    `langcode` VARCHAR(12) NOT NULL COLLATE 'ascii_general_ci',
    PRIMARY KEY (`tid`),
    UNIQUE INDEX `taxonomy_term_field__uuid__value` (`uuid`),
    INDEX `taxonomy_term_field__vid__target_id` (`vid`)
)
COMMENT='The base table for taxonomy_term entities.'
COLLATE='utf8mb4_general_ci'
ENGINE=InnoDB
AUTO_INCREMENT=2157
;

And now:

CREATE TABLE `taxonomy_term_data` (
    `tid` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
    `vid` VARCHAR(32) NOT NULL COMMENT 'The ID of the target entity.' COLLATE 'ascii_general_ci',
    `uuid` VARCHAR(128) NULL DEFAULT NULL COLLATE 'ascii_general_ci',
    `langcode` VARCHAR(12) NOT NULL COLLATE 'ascii_general_ci',
    PRIMARY KEY (`tid`),
    INDEX `taxonomy_term_field__vid__target_id` (`vid`)
)
COMMENT='The base table for taxonomy_term entities.'
COLLATE='utf8mb4_general_ci'
ENGINE=InnoDB
AUTO_INCREMENT=2157
;

So uuid line changed and UNIQUE INDEX removed. I applied those changes in the database and after that I could use the drush entity-updates.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.