Upvote:5
This is a non-trivial medical issue, so let's not fuzz around with this: You need to go and see an good ear doctor and talk it through with them.
The reason for the pain are changes in air pressure. These need to be equalized between the outer world and your middle ear cavity. That, apparently, doesn't work well for you and hence the ear pain. If the pressure between both sides of your ear drum isn't the same your ear drum will be either pushed out (going up) or pushed in (going down). This as a) painful and b) potentially dangerous, so you should NOT paper it over with pain killers.
The best way to proceed depends on the details of your medical condition, so it can only be determined by a trained professional who is familiar with your specifics.
Don't follow medical advice from strangers on the Internet.