Will having a history of depression prevent me from flying?
This is one of those questions where you really need to talk to an AME, preferably one who has significant experience working through these sorts of issues.  In order to get the Class II medical that you'll need to fly commercially, you'll end up needing to work through the process anyway, so you're probably better off starting with the expert, rather than with a message board like this one.  

The only case where you'd save any money by starting here is if someone here were to accurately tell you that there is no need to go to an AME as there is no way anything could possibly work.  I doubt you're going to get that sort of advice, because (a) we don't have any AME's that post here on av.se, as far as anybody has ever self-identified, at least, and (b) this stuff is sufficiently complicated that you don't want to trust a layman's info or opinions, even one who "knew somebody who had a similar situation."

That said, I'd suspect that the chances are pretty good that you may well be able to get a medical certificate, so I would encourage you to pursue that path.  Let a good AME take a look at the specifics of what your history looks like, and listen to his/her advice about what would need to happen (maybe very little, maybe quite a bit) in order to satisfy the FAA.

This thread deals with an entirely different medical condition, but the answers, and the logic behind them, apply here as well.

Be honest with the flight surgeon, and don't let random posters here talk you out of giving yourself every opportunity to pursue your dream of flying commercially.

Best of luck to you!