/**
 * Implements hook_user_role_delete().
 */
function {{ machine_name }}_user_role_delete($role) {
  // Delete existing instances of the deleted role.
  db_delete('my_module_table')
    ->condition('rid', $role->rid)
    ->execute();
}
