I've tried hair of the dog
I think you're talking about a hangover headache,
TURIN, not a migraine which, as
5th points out, is a completely different thing.
No one can say with certainty what the causes of migraine are although there are some classic advance warning symptoms like visual disturbances etc. before the actual pain begins.
In my own case, the only medication that ever worked effectively was an injection of pethidine or morphine every six hours plus an antimetic to control the vomiting. I was never able to lie flat as that only made matters worse, but a dark room was essential. There's not much else you can do unless you are one of the lucky ones who responds to some of the other available medications ... self administered by "Epi-Pen" or other means.
Not much fun, migraines.