Fix foreign key constraint issue when deleting a permission or role