function profile2_update_7101 in Profile 2 7
Same name and namespace in other branches
- 7.2 profile2.install \profile2_update_7101()
Add a label column to profiles.
File
- ./
profile2.install, line 187 - Install, update and uninstall functions for the profile module.
Code
function profile2_update_7101() {
db_add_field('profile', 'label', array(
'description' => 'A human-readable label for this profile.',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
));
$types = db_select('profile_type', 'p')
->fields('p')
->execute()
->fetchAllAssoc('type');
// Initialize with the type label.
foreach ($types as $type_name => $type) {
db_update('profile')
->fields(array(
'label' => $type->label,
))
->condition('type', $type_name)
->execute();
}
}