Migraines are not always preventable. Not all are caused by obvious triggers (maybe no trigger at all). I have chronic migraines, at least a couple different types.
If you want to try to avoid migraines keep a food, meds, and activity journal. This should be helpful in pointing out any problematic behaviors. Also, be especially careful to avoid taking too many otc pain relievers (or otherwise) as this leads to rebound headache which is indescribable. Some people are sensitive to certain medications, ie I cannot take anything with opiates or I wish I could just crawl into a hole for a week from the pain... go figure.
If migraines are a problem/chronic see a neurologist for them - research shows they may cause more damage/problems than formerly known. If you note all the people who don't know if they have MS/whatever b/c MRI may show migraine or stroke activity, well, do something sooner rather than later.
Luck to you.
Hello and hope you are doing well.
Since the medication is worsening your symptoms, consult your doctor for alternate medications for migraine. For migraines cure can also be in terms of avoiding trigger factors. You can prevent the occurrence of headaches by avoiding trigger factors that induce an attack. Alcohol, smoking, altered sleep patterns, missed meals, loud sounds, odd smells, physical or emotional stress and certain additive foods are known to trigger attacks. In short if you eat a well balanced diet, exercise moderately and lead a stress free life then you will be successful in preventing attacks.
Hope this helped and do keep us posted.