I've heard it was before he was president too, supposedly before he was governor too if I remember right.
Not sure he's ever directly given any details about the cocaine deal, but I remember him being pretty public about being intentionally sober because he knew he couldn't handle it. Although, I don't think he considers himself an actual alcoholic.