function vat_number_update_7001 in VAT Number 7
Change column from _vat_number to _value.
File
- ./
vat_number.install, line 33
Code
function vat_number_update_7001(&$sandbox = NULL) {
$ret = array();
$fields = array();
foreach (field_info_fields() as $field) {
if ($field['type'] == 'vat_number') {
$fields[] = $field;
}
}
foreach ($fields as $field) {
$tables = array(
_field_sql_storage_tablename($field),
_field_sql_storage_revision_tablename($field),
);
foreach ($tables as $table) {
$field_name = $field['field_name'];
$column_old = $field_name . '_vat_number';
$column_new = $field_name . '_value';
$spec = array(
'description' => 'Vat Number',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
);
db_change_field($table, $column_old, $column_new, $spec);
// old and new col are same
}
}
return t('Database column name updated.');
}