Replace serial role IDs with machine name strings.
function block_update_8002() {
// Change serial rid column into string.
$column = array(
'type' => 'varchar',
'length' => 64,
'not null' => TRUE,
'description' => "The user's role ID from {users_roles}.rid.",
);
db_change_field('block_role', 'rid', 'rid', $column);
// Rename the built-in serial role IDs into the hardcoded machine names.
db_update('block_role')
->fields(array(
'rid' => DRUPAL_ANONYMOUS_RID,
))
->condition('rid', 1)
->execute();
db_update('block_role')
->fields(array(
'rid' => DRUPAL_AUTHENTICATED_RID,
))
->condition('rid', 2)
->execute();
}