I get migraines occasionally, and one of my friends who gets them very regularly explained that it is all to with blood supply to the brain (as told him by his doctor, so sorry if there’s any inaccuracies in here).
The basic premise is that the blood vessels in the brain constrict for no known reason (this is why people on beta-blockers for other conditions do not get migraines). The brain reacts to the decreased blood (& oxygen) supply by producing a feeling of pain, and by shutting down non-essential systems, to divert blood back to the rest of the body & by ordering the blood vessels to open up.
At this stage, you’ll have a hell of a headache, and feel really nauseous - you may or may not vomit. This is due to the fact that the digestive system is considered a non-core system (the same process happens to a lesser degree when you are scared/nervous, the adrenalin shuts down the digestion temporarily, producing those butterfly in tummy feelings). Shutting down the digestion also relieves the load on the liver, and that is a major system, receiving a lot of blood. Anyway, whether or not you vomit at this stage, the brain is already entering the next phase - a more normal-feeling (though often still incredibly intense), headache.
This is due to the opposite reason - it now has too much blood going to it, and so it produces a higher pressure (sorry, best way for me to describe it, I’m sure there’s a more technically accurate term) which stresses the brain cells.
As the brain gets its blood supply balanced and under control, the pain from the over-reaction gradually goes away and your other systems start to open up again, allowing you to start to feel hungry instead of nauseous, etc.
Migraines are often increased in frequency by stress, or triggered by a reaction to some chemical. Technically it isn’t an allergy, as allergies involve a histo-immune response, but rather a migraine trigger. Most people will know what you mean though, if you were to say “I’m allergic to chocolate, it gives me migraines”. It is worth looking closely at what you have eaten at times that the migraines come on and avoiding the food if there is a common factor.
If migraines persist or are very frequent, there is a drug that can be prescribed, which stops the brain doing the complete shutdown, complete opening up response, which prevents the nausea and long recovery. It can be given orally (if taken in time before the nausea onsets), or injected. I don’t know the name of it, but since causes of migraines are many and varied, I’d recommend seeing your physician anyway.