function boxes_update_6102 in Boxes 6
Same name and namespace in other branches
- 7 boxes.install \boxes_update_6102()
Make the box.delta column definition match blocks.delta
File
- ./
boxes.install, line 134
Code
function boxes_update_6102() {
$ret = array();
$result = db_result(db_query('SELECT delta FROM {box} WHERE CHAR_LENGTH(delta) > 32'));
if (empty($result)) {
db_drop_primary_key($ret, 'box');
$spec = array(
'type' => 'varchar',
'length' => 32,
'not null' => TRUE,
);
$new_keys = array(
'primary key' => array(
'delta',
),
);
db_change_field($ret, 'box', 'delta', 'delta', $spec, $new_keys);
}
else {
$ret['#abort'] = array(
'success' => FALSE,
'query' => "Could not resize the `box.delta` field. Some entries are larger than 32 characters and must be manually truncated.",
);
}
return $ret;
}