I updated successfully from 7x4-alpha6 to 7x4.2 and ran database updates which were successful as well. I went to add a new form component text field and I get this error below?

PDOException: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'required' in 'field list': INSERT INTO {webform_component} (nid, cid, pid, form_key, name, type, value, extra, required, weight) 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); Array ( [:db_insert_placeholder_0] => 543 [:db_insert_placeholder_1] => 51 [:db_insert_placeholder_2] => 0 [:db_insert_placeholder_3] => test_ [:db_insert_placeholder_4] => test [:db_insert_placeholder_5] => textfield [:db_insert_placeholder_6] => [:db_insert_placeholder_7] => a:4:{s:13:"title_display";s:6:"before";s:7:"private";i:0;s:15:"wrapper_classes";s:0:"";s:11:"css_classes";s:0:"";} [:db_insert_placeholder_8] => 0 [:db_insert_placeholder_9] => 38 ) in webform_component_insert() (line 782 of /var/www/hosts/kmdsi-d/sites/all/modules/webform/includes/webform.components.inc).

After researching webform issues I have found multiple solution to change column name from "mandatory" to "required" like this one here: https://www.drupal.org/node/2316743

Solutions I have tried:
1) change column name from "mandatory" to "required", then update database
2) update 7x4.2 to 7x4.2-dev and update database
3) uninstalled webform module and then re-installed module and update dbase

Please let me know if anyone has solutions...Thanks for you time felllow drupalers!

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

DanChadwick’s picture

Status: Active » Fixed

Somewhere along the line, update didn't run or didn't run successfully. You need to restore the version of webform whose update routine last worked, then disable the module, then disable uninstall the module, then download the latest version, then re-enable the module. In this way, your tables will be re-created.

If this isn't possible, then you will have to examine the database and look at the update routines in webform.install to see what changes need to be made by hand. This may or may not be practical, depending upon what you find.

Ndesign’s picture

Sounds good Dan I will give it a shot and see what I find upon updates...Thank you!

Ndesign’s picture

Things worked just fine with disabling old version and enabling 7x4.2 with no database updates : ) ..thank you so much....Is there an easy way to import webform content types and/or submissions?

DanChadwick’s picture

No. When you uninstalled, all the webforms and submissions were deleted. To re-import them, you could use something like migrate, but I'm pretty sure there would be a ton of custom code involved. Bummer.

Ndesign’s picture

Okay thanks again for your help.

Status: Fixed » Closed (fixed)

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

VVS’s picture

Im manually run:
ALTER TABLE `webform_component` CHANGE `mandatory` `required` TINYINT(4) NOT NULL DEFAULT '0' COMMENT 'Boolean flag for if this component is required.';

aubjr_drupal’s picture

If by chance you run into an error like:

PDOException: SQLSTATE[22004]: Null value not allowed: 1138 Invalid use of NULL value: ALTER TABLE {webform_component} CHANGE `mandatory` `required` TINYINT NOT NULL DEFAULT 0 COMMENT 'Boolean flag for if this component is required.'; Array ( ) in db_change_field() ....

There are probably some rows in the webform_component table that have mandatory set to NULL. If you verify this is the case, clear out the NULLs with something like:

UPDATE webform_component SET mandatory=0 WHERE mandatory IS NULL;

At that point, the webform update #7408 will apply cleanly.