function webform_update_6311 in Webform 6.3
Convert the "no" column to be a varchar column instead of an integer.
File
- ./
webform.install, line 1015 - Webform module install/schema hooks.
Code
function webform_update_6311() {
$ret = array();
// Change the column.
db_drop_primary_key($ret, 'webform_submitted_data');
db_change_field($ret, 'webform_submitted_data', 'no', 'no', array(
'type' => 'varchar',
'length' => 128,
'not null' => TRUE,
'default' => '0',
), array());
db_add_primary_key($ret, 'webform_submitted_data', array(
'nid',
'sid',
'cid',
'no',
));
// Update date components.
$ret[] = update_sql("UPDATE {webform_submitted_data} SET no = 'month' WHERE no = '0' AND (nid, cid) IN (SELECT nid, cid FROM {webform_component} WHERE type = 'date')");
$ret[] = update_sql("UPDATE {webform_submitted_data} SET no = 'day' WHERE no = '1' AND (nid, cid) IN (SELECT nid, cid FROM {webform_component} WHERE type = 'date')");
$ret[] = update_sql("UPDATE {webform_submitted_data} SET no = 'year' WHERE no = '2' AND (nid, cid) IN (SELECT nid, cid FROM {webform_component} WHERE type = 'date')");
// Update time components.
$ret[] = update_sql("UPDATE {webform_submitted_data} SET no = 'hour' WHERE no = '0' AND (nid, cid) IN (SELECT nid, cid FROM {webform_component} WHERE type = 'time')");
$ret[] = update_sql("UPDATE {webform_submitted_data} SET no = 'minute' WHERE no = '1' AND (nid, cid) IN (SELECT nid, cid FROM {webform_component} WHERE type = 'time')");
$ret[] = update_sql("UPDATE {webform_submitted_data} SET no = 'ampm' WHERE no = '2' AND (nid, cid) IN (SELECT nid, cid FROM {webform_component} WHERE type = 'time')");
// Updating of select and grid components is done in following updates.
return $ret;
}