There are studies that support this: https://pubmed.ncbi.nlm.nih.gov/33779525/
Conclusions: A pooled analysis of available randomized controlled clinical trials demonstrated that Vitamin B2 400 mg/day for three months supplementation had significant effect on days, duration, frequency, and pain score of migraine attacks.
For some months I've been taking 200 mg/day and it reduced the frequency of my migraine attacks in half.