Using the dev version dated 12/18/16, I ran the update to webform and it completed the initial process. However, when I went to do a database update it only ran the first two and then threw up the follow error:

An AJAX HTTP error occurred.
HTTP Result Code: 200
Debugging information follows.
Path: /update.php/start?id=773&op=do_nojs&op=do
StatusText: OK
ResponseText:
Fatal error: Call to undefined function webform_schema() in /home/xxx/public_html/modules/webform/includes/webform.update.inc on line 165

Comments

jlsegul created an issue. See original summary.

jrockowitz’s picture

Please install the latest dev release and you should be okay.

Please make sure that the webform.update.inc file is removed when you update the module.

jlsegul’s picture

The latest dev version correctly installed. The forms all work correctly, yaml form was disabled and the update file deleted itself correctly. It just left one little error on the status report:

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.

Webform submission
The Webform field needs to be updated.

Any idea why?

Thanks

jrockowitz’s picture

Priority: Critical » Normal

Yep, that makes sense because of #2834203: Convert yamlform field target_id from 255 characters to 32 characters.. Did you run the db update?

jlsegul’s picture

Yes, I ran update.php a couple of times. The only update that came up was for webform_UI.

jrockowitz’s picture

Try running cron.

Can you execute the below SQL and see if there are any records?

SELECT * FROM key_value WHERE collection LIKE '%yamlform%';

If there are some records please try running the below SQL..

UPDATE key_value SET collection = REPLACE(collection, 'yamlform', 'webform');

Please give me an update ASAP since I think other people might be having the same issue.

jrockowitz’s picture

Below is the update hook that will most likely need to be added to the webform module.

/**
 * Issue #2837090: Undefined function call webform_schema.
 */
function webform_update_8010() {
  // Fix key_value.collection which was no updated during the migration.
  if (Database::getConnection('default')->databaseType() == 'mysql') {
    db_query("UPDATE {key_value} SET collection = REPLACE(collection, 'yamlform', 'webform');");
  }
}
jlsegul’s picture

I assume that I run this from root. I normally use macOS terminal for composer and such commands. Anyway, when I run SELECT * FROM key_value WHERE collection LIKE '%yamlform%'; I get the following error message: -bash: syntax error near unexpected token `from'

Is there another place I should be running this statement or software program? I noticed it also didn't like capital letters in terminal.

jrockowitz’s picture

It is SQL statement so you need to execute in MySQL via something like PHPMyAdmin.

If you have drush installed you can also execute the below command from bash.

drush sqlq "SELECT * FROM key_value WHERE collection LIKE '%yamlform%';"

jlsegul’s picture

Thanks. Used phpAdmin to run the query and got a 0 rows affected result. Can't figure out why update won't see that they need updating.

jrockowitz’s picture

Glad to hear the query returned 0 rsults.

Updating the database won't resolve the warning.

You need to run drush entity-updates . See https://www.drupaleasy.com/quicktips/drupal-8-mismatched-entity-field-de...

jlsegul’s picture

Well, that was interesting. I logged into root and installed Drush VPS wide. I ran entity-updates and got this message:

The following updates are pending:

node entity type :
The node.webform field needs to be updated.
webform_submission entity type :
The Webform field needs to be updated.
Do you wish to run all pending updates? (y/n): y

Drupal\Core\Entity\Exception\FieldStorageDefinitionUpdateForbiddenException:[error]
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
/home/seagullcom/public_html/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php).
Failed: [error]
Drupal\Core\Entity\Exception\FieldStorageDefinitionUpdateForbiddenException:
!message in Drupal\Core\Entity\Sql\SqlContentEntityStorageSchema->updateDedicatedTableSchema()
(line 1285 of
/home/seagullcom/public_html/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php).
Cache rebuild complete. [ok]
Finished performing updates.

Nothing is simple, but I'm learning a lot.

jrockowitz’s picture

I think one of the update hooks from #2834203: Convert yamlform field target_id from 255 characters to 32 characters. failed to run.

You could try to manually converting the webform field from 255 characters to 32 characters using PHPMyAdmin.

abaier’s picture

I am also experiencing update problems, also after a successful migration using the latest dev versions of yamlform and webform.
I was able to fix the status notices running drush entup.

Today I tried running drush updb from 8.x-5.0-beta2+13-dev to 8.x-5.0-beta3 and got an error in the following process: webform module: 8005 - Issue #2837090: Undefined function call webform_schema.

Performing webform_update_8005  [ok]
Failed: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry  [error]
'config.entity.key_store.webform-uuid:b1836de1-c697-4f64-84ce-5b7' for key 'PRIMARY': UPDATE
{key_value} SET collection = REPLACE(collection, 'yamlform', 'webform'); Array
(
)

My drush output for the sql query in #9 is:

config.entity.key_store.yamlform	uuid:1ebeaad2-b005-4ff5-a56d-d829cd3f254d	a:1:{i:0;s:23:"webform.webform.contact";}
config.entity.key_store.yamlform	uuid:b1836de1-c697-4f64-84ce-5b76eecb4e61	a:1:{i:0;s:26:"webform.webform.abonnieren";}
config.entity.key_store.yamlform_options	uuid:1c12cb3c-c6c8-4327-92e8-f4d55502229f	a:1:{i:0;s:33:"webform.webform_options.ethnicity";}
config.entity.key_store.yamlform_options	uuid:25239d32-113a-4b2f-9494-8b02ea043eef	a:1:{i:0;s:33:"webform.webform_options.education";}
config.entity.key_store.yamlform_options	uuid:2fd5e34d-3991-4ae7-b269-15c99f7190a0	a:1:{i:0;s:33:"webform.webform_options.languages";}
config.entity.key_store.yamlform_options	uuid:313cd244-b0c2-40be-8b9b-422f500b42c9	a:1:{i:0;s:32:"webform.webform_options.industry";}
config.entity.key_store.yamlform_options	uuid:32633436-6964-447e-9223-ef4fa02f7802	a:1:{i:0;s:44:"webform.webform_options.state_province_codes";}
config.entity.key_store.yamlform_options	uuid:3560853f-cfa0-4a02-8284-7f131df4030d	a:1:{i:0;s:40:"webform.webform_options.likert_agreement";}
config.entity.key_store.yamlform_options	uuid:4f936bef-bc85-43fd-8e56-66d008f829ee	a:1:{i:0;s:40:"webform.webform_options.likert_ten_scale";}
config.entity.key_store.yamlform_options	uuid:6cf7d10d-6ff8-4483-a4bf-7b2dd5e034fd	a:1:{i:0;s:40:"webform.webform_options.creditcard_codes";}
config.entity.key_store.yamlform_options	uuid:70a1fe9c-79b6-4706-a807-5bc269769307	a:1:{i:0;s:28:"webform.webform_options.size";}
config.entity.key_store.yamlform_options	uuid:71693fc3-99d0-4d11-9db3-37bb983b96a5	a:1:{i:0;s:37:"webform.webform_options.country_names";}
config.entity.key_store.yamlform_options	uuid:7415dfdd-b638-476d-8850-92907db2ec32	a:1:{i:0;s:40:"webform.webform_options.likert_would_you";}
config.entity.key_store.yamlform_options	uuid:74332fd8-4474-484c-83f3-429dbee3ca03	a:1:{i:0;s:44:"webform.webform_options.state_province_names";}
config.entity.key_store.yamlform_options	uuid:7621b396-a61f-4c83-9d4d-b9cf2d46f4e1	a:1:{i:0;s:34:"webform.webform_options.time_zones";}
config.entity.key_store.yamlform_options	uuid:7a1087bc-6b48-4eba-ac65-203b2bbbb1ec	a:1:{i:0;s:41:"webform.webform_options.employment_status";}
config.entity.key_store.yamlform_options	uuid:7a4b7bb0-78d7-4eeb-a119-ff4f654d2552	a:1:{i:0;s:30:"webform.webform_options.titles";}
config.entity.key_store.yamlform_options	uuid:840ac6df-c144-47d3-81bb-9d0fced6e2f3	a:1:{i:0;s:38:"webform.webform_options.marital_status";}
config.entity.key_store.yamlform_options	uuid:85811cd7-3766-49fc-98ec-448c805c38f4	a:1:{i:0;s:41:"webform.webform_options.likert_importance";}
config.entity.key_store.yamlform_options	uuid:8e720ac1-6a0c-49f4-8832-7b9b4f25cb76	a:1:{i:0;s:36:"webform.webform_options.relationship";}
config.entity.key_store.yamlform_options	uuid:9ec288c4-2548-4b13-b918-b421b4ee9b3b	a:1:{i:0;s:28:"webform.webform_options.days";}
config.entity.key_store.yamlform_options	uuid:a315543b-9688-4815-a6ab-ec62701e58be	a:1:{i:0;s:35:"webform.webform_options.state_names";}
config.entity.key_store.yamlform_options	uuid:ba62613c-e4d2-4acb-83a4-279817941912	a:1:{i:0;s:37:"webform.webform_options.country_codes";}
config.entity.key_store.yamlform_options	uuid:dc3bd7ea-c9f8-4015-a4cf-028b30ac580c	a:1:{i:0;s:30:"webform.webform_options.months";}
config.entity.key_store.yamlform_options	uuid:dc4508ba-aa43-4f88-ae58-ec188e9d3f23	a:1:{i:0;s:41:"webform.webform_options.likert_comparison";}
config.entity.key_store.yamlform_options	uuid:dc460b5e-f0e6-45a4-bf05-5070d74a4e47	a:1:{i:0;s:43:"webform.webform_options.likert_satisfaction";}
config.entity.key_store.yamlform_options	uuid:e2974dc3-f95f-4994-aec1-2b422fbf661d	a:1:{i:0;s:35:"webform.webform_options.state_codes";}
config.entity.key_store.yamlform_options	uuid:f0b1e620-8426-47b1-a4c5-e6acbc924fc6	a:1:{i:0;s:30:"webform.webform_options.yes_no";}
config.entity.key_store.yamlform_options	uuid:f725dad9-2efb-4400-8d39-84ee187d9224	a:1:{i:0;s:30:"webform.webform_options.gender";}

Any advise how I could run this update successfully and if my migration really was finished correctly? Thanks in advance!

jrockowitz’s picture

Priority: Normal » Major

The issue is the migration failed to update the key_value.collection column and I am attempting to fix this issue via an update hook.

I am think there are now orphaned yamlform records in this table.

For now I am going to have to remove the update hook.

@toni4i Can you export your entire key_value table so that I can examine it and hopefully fix it? I might be able to just delete the old yamlform records.

abaier’s picture

Yes, sure. I sent you a pm with a wetransfer link to the dump.

jrockowitz’s picture

Can someone please test the attached patch?

Please run the below query before and after testing the patch. Hopefully after you run the query no results will be returned.

SELECT * FROM key_value WHERE collection LIKE '%yamlform%';

jrockowitz’s picture

Status: Active » Needs review
StatusFileSize
new1.69 KB

  • jrockowitz committed 5bd1f95 on 8.x-1.x
    Issue #2837090 by jrockowitz: Undefined function call webform_schema
    
jrockowitz’s picture

Status: Needs review » Fixed

Fixed Please download or checkout the latest dev release.

jlsegul’s picture

The drush entup command did fix the problem. Thanks everyone.

abaier’s picture

Thanks Jake! Using the latest dev of webform, the update mentioned in #14 went through successfully. Regarding the output of SELECT * FROM key_value WHERE collection LIKE '%yamlform%'; I have to disappoint you – this has not changed after the update. Still exactly the same. Should I be worried about that or could I just leave these entries in my db without risking conflicts?

The patch of #18 was included in the latest dev, right? Or did I have to apply it?

  • jrockowitz committed c3332e2 on 8.x-1.x
    Issue #2837090 by jrockowitz: Undefined function call webform_schema
    
jrockowitz’s picture

@toni4i The patch from #18 did not apply correctly to the webform module.

Can you please update your copy of the webform module to latest dev release and run the database updates.

abaier’s picture

Perfect, now the output for the query is empty. Thanks for the quick fix!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.