I am not a doctor and what I’m about to suggest is up to you to do your own research.
Coincidentally, on Friday I got an email about Vitamin D3 and migraines from the Vitamin D council. It said that people with low levels of Vitamin D get more headaches and when a person normalizes their D3, the frequency lessens considerably. Bonus! D3 also helps with depression.
Like the following clinical study suggests, I take 10,000 IUs per day. I use Jarrow Formulas or Solgar.
https://n.neurology.org/content/82/10_Supplement/P1.256