function webform_update_6205 in Webform 6.2
Same name and namespace in other branches
- 6.3 webform.install \webform_update_6205()
Schema fixes to make Drupal 5 upgrades identical to clean Drupal 6 installs.
File
- ./
webform.install, line 955 - Webform module install/schema hooks.
Code
function webform_update_6205() {
$ret = array();
// Remove disp-width and default from webform.nid.
db_drop_primary_key($ret, 'webform');
db_change_field($ret, 'webform', 'nid', 'nid', array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
), array(
'primary key' => array(
'nid',
),
));
// Set not null property on webform.confirmation.
db_change_field($ret, 'webform', 'confirmation', 'confirmation', array(
'type' => 'text',
'not null' => TRUE,
));
// Set size to tiny, remove disp-width on webform.submit_limit.
db_change_field($ret, 'webform', 'submit_limit', 'submit_limit', array(
'type' => 'int',
'size' => 'tiny',
'not null' => TRUE,
'default' => -1,
));
// Set default value to -1, remove disp-width on webform.submit_interval.
db_change_field($ret, 'webform', 'submit_interval', 'submit_interval', array(
'type' => 'int',
'not null' => TRUE,
'default' => -1,
));
// Set not null property on webform.additional_validate.
db_change_field($ret, 'webform', 'additional_validate', 'additional_validate', array(
'type' => 'text',
'not null' => TRUE,
));
// Set not null property on webform.additional_submit.
db_change_field($ret, 'webform', 'additional_submit', 'additional_submit', array(
'type' => 'text',
'not null' => TRUE,
));
// Set not null property, default on webform_component.name.
db_change_field($ret, 'webform_component', 'name', 'name', array(
'type' => 'varchar',
'length' => 255,
));
// Set not null property on webform_component.value.
db_change_field($ret, 'webform_component', 'value', 'value', array(
'type' => 'text',
'not null' => TRUE,
));
// Set not null property on webform_component.extra.
db_change_field($ret, 'webform_component', 'extra', 'extra', array(
'type' => 'text',
'not null' => TRUE,
));
// Set column size, disp-width on webform_component.mandatory.
db_change_field($ret, 'webform_component', 'mandatory', 'mandatory', array(
'type' => 'int',
'size' => 'tiny',
'not null' => TRUE,
'default' => 0,
));
// Set column size, disp-width, not null property on webform_component.weight.
db_change_field($ret, 'webform_component', 'weight', 'weight', array(
'type' => 'int',
'size' => 'small',
'not null' => TRUE,
'default' => 0,
));
// Set unsigned, not null property on webform_submissions.sid.
db_drop_unique_key($ret, 'webform_submissions', 'sid_nid');
db_change_field($ret, 'webform_submissions', 'sid', 'sid', array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
));
db_drop_primary_key($ret, 'webform_submissions');
db_change_field($ret, 'webform_submissions', 'sid', 'sid', array(
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE,
), array(
'primary key' => array(
'sid',
),
'unique keys' => array(
'sid_nid' => array(
'sid',
'nid',
),
),
));
// Temporarily drop all keys from the webform_submitted_data table for changes.
db_drop_primary_key($ret, 'webform_submitted_data');
db_drop_index($ret, 'webform_submitted_data', 'nid');
db_drop_index($ret, 'webform_submitted_data', 'sid_nid');
// Set unsigned, size on webform_submitted_data.no.
db_change_field($ret, 'webform_submitted_data', 'no', 'no', array(
'type' => 'int',
'unsigned' => TRUE,
'size' => 'tiny',
'not null' => TRUE,
'default' => 0,
));
// Set size, not null property on webform_submitted_data.data.
db_change_field($ret, 'webform_submitted_data', 'data', 'data', array(
'type' => 'text',
'size' => 'medium',
'not null' => TRUE,
));
// Set correct keys.
db_add_primary_key($ret, 'webform_submitted_data', array(
'nid',
'sid',
'cid',
'no',
));
db_add_index($ret, 'webform_submitted_data', 'nid', array(
'nid',
));
db_add_index($ret, 'webform_submitted_data', 'sid_nid', array(
'sid',
'nid',
));
return $ret;
}