function data_update_6002 in Data 7
Same name and namespace in other branches
- 6 data.install \data_update_6002()
Add a primary key, required by CTools. Shorten name key to 128 char max.
File
- ./
data.install, line 139 - Install hooks for Data module.
Code
function data_update_6002() {
$ret = array();
db_drop_index('data_tables', 'name');
$spec = array(
'type' => 'varchar',
'length' => '128',
'not null' => TRUE,
'default' => '',
'description' => 'Table name.',
);
db_change_field('data_tables', 'name', 'name', $spec);
db_add_primary_key('data_tables', array(
'name',
));
// reset cTools static cache of this table; otherwise it throws an error about
// lacking a primary key, which just adds insult to injury as we're trying to fix that!
drupal_get_schema('data_tables', TRUE);
if (function_exists('drupal_static_reset')) {
drupal_static_reset('ctools_export_get_schema');
}
// hook_update_N() no longer returns a $ret array. Instead, return
// nothing or a translated string indicating the update ran successfully.
// See http://drupal.org/node/224333#update_sql.
return t('TODO Add a descriptive string here to show in the UI.');
}