I'm seeing entity-updates fail on webform fields and entities with the following output:
Drupal\Core\Entity\Exception\FieldStorageDefinitionUpdateForbiddenException: The SQL storage cannot change the schema for an existing field (webform in node entity) with data. in Drupal\Core\Entity\Sql\SqlContentEntityStorageSchema->updateDedicatedTableSchema() (line 1285 of /var/www/[redacted]/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php).
When running drush entity-updates I see the following marked as needing updates:
The following updates are pending:
node entity type :
The node.webform field needs to be updated.
webform_submission entity type :
The Webform submission entity type needs to be updated.
Comments
Comment #2
bobbygryzyngerHere's some additional output:
Comment #3
bobbygryzyngerComment #4
jrockowitz commented@bobby.gry You might need to compare the table scheme for a clean install of the webform module to your current version of the webform module. I can only guess what is out-of-sync.
Comment #5
bobbygryzynger@jrockowitz - I have some steps to reproduce for you, this appears to be a problem going back to yamlform and this is manifesting post-migration.
1. Install Drupal
2. Enable
yamlform beta 143. Enable
yamlform_node4. Create a test form
5. Create two yamlform pages, one with a short title, one with a very long title and attach the test form to them.
6. Create submissions in both yamlform pages
7. Update to
yamlform beta 298. Run
drush updb9. Run
drush entity-updates. Here I will see that the following entities need updating:This final step will fail with errors similar to the ones above:
I have attached a dump file of a fresh install at this failure point. Let me know if any additional information would be helpful.
Comment #6
bobbygryzynger@jrockowitz is there anything else that I could provide here that would be helpful in addressing this issue?
Comment #7
jrockowitz commented@bobby.gry Not really, you might be stuck manually exporting the forms and data, reinstalling the module, and reimporting the forms and data.
Comment #8
anpolimusComment #9
jrockowitz commentedI think the source of the problem is existing webform nodes migrated from D6/D7 to D8 are conflicting with the Webform 8.x-5.x node module.
I added a requirement that checks for this problem before the Webform node module is installed.
@see #2856599: Unable to install Sub-module Webform Node
If anyone else is migrating from the YAML Form to the Webform module, they should make sure to delete any existing webform nodes.
Comment #10
bobbygryzynger@jrockowitz - in my case this was not the result of a migration from a previous version of Webform. Instead, we are seeing it while attempting to migrate our original YAMLform installation to Webform.
Comment #11
criscomI migrated YAML forms to Webforms at the start of 2017 and this problem now suddenly pops up for me too. I do not have any webform data from D6 or D7 as the website was build with D8.
What I tried to do was to install a new module with composer. After that I ran drush entup which caused the below problem:
Comment #12
criscomI was able to solve my problem with:
composer update drupal/webform --with-dependenciesComment #13
adrian83 commentedThe classic drush entup command was failing to fix the "Mismatched entity and/or field definitions" error for me. #12 fixed one of my errors. After that I could run drush entup to fix the rest of them. After updating webform the 3rd party libraries were out of date, so I needed to run drush webform-libraries-download. Looking good now.
Comment #14
jrockowitz commentedHmmm... I am not using composer to test my update hooks.
@criscom Why would
composer update drupal/webform --with-dependenciesfix the issue.What is
--with-dependenciesdoing? I thought the webform module does not have any dependencies because 3rd party libraries are handled outside of the webform/composer.json file.Comment #15
cadew commentedSince the last update to Webform, done through the Drupal UI, I've been getting this error:
ENTITY/FIELD DEFINITIONS Mismatched entity and/or field definitions
The following changes were detected in the entity type and field definitions.
Content - The node.webform field needs to be updated.
I have not upgraded from a previous form; this is a fresh install of Webform last month, on a Drupal installation that only had the default Contact forms previously.
Is there any way to solve this without using Drush or Composer? I am sure it would probably be easier to fix with one or both, but it's just not possible to install them on the site at the moment.
Thanks :)
Comment #16
adrian83 commented@jrockowitz I had been assuming that the key was that I updated webform to the latest version, not specifically that I used composer to do the update. However, I have no proof.
@cadew Your case might be a good test. Try this (if you have access to your web root.)
If that works to clear your error, I'd guess that the error has nothing to do with either Composer or Drush.
Comment #17
cadew commented@Adrian83, thanks. I am giving this a shot. Webform is up to date according to the status report, so I skipped to Step 2.
AND IT WORKS after clearing caches.
Thank you!
I know we're not supposed to mess with core, but ....
I am not a PHP expert, but I can't see how a try/catch like that would hurt anything if I kept it in there?
Comment #18
adrian83 commented@cadew I'm don't know enough to tell you either way, but if I remember correctly, the advice in that other thread was to remove the code afterwards.
Comment #19
cadew commentedUnderstood, @Adrian83. Thanks again for that link.
Comment #20
criscomHi Jacob,
I cannot answer your question. I just tried
composer update drupal/webform --with-dependenciesand the error went away for me. As far as I can remember, composer either downloaded the same version again or a newer version. After that everything worked fine. I also could not reproduce the problem on any other site where I migrated from YAML forms to webform.Chris
Comment #21
jrockowitz commentedMarking as fixed since there is not much else that can be added to this ticket.
Comment #22
frederickjh@jrockowitz in case you have not figure it out by now, the
--with-dependenciesincomposer update drupal/webform --with-dependenciesupdates the dependencies of drupal/webform. By default if you specify packages to update, composer will not update dependencies of those packages just the package given on the commandline.I normally run
composer update --dry-runto see what will be updated. This way I can see what will be updated if I runcomposer updatewithout specifying any packages to update.Frederick
Comment #24
ashishsahu3847 commentedafter upgrade webform 8.x-5.0-rc16 to 8.x-5.0-rc18 Unable to edit field component on the existing webform