Yes. Magnesium and riboflavin deficiencies may contribute to migraines. You can check blood levels of these but want to look at intracellular rather than serum magnesium. Certain foods also may be triggers such as hard cheeses, chocolate, caffeine, processed or cured meats, red wine, alcohol, food preservatives, etc.
Maybe. Identifying and then avoiding triggers is important in preventing migraines. While these triggers are vary from person to person, food-related triggers include undereating and overeating (try to eat regular meals), alcohol, MSG, and caffeine. Supplements that may help with migraines include magnesium, coenzyme q10, riboflavin (vitamin B2), and feverfew, but more study is needed.