Those who took magnesium for migrains

How much did you take? Went to the er and they gave me magnesium to make it feel better and it worked. I know some of you have commented that that is what helped you as well. My prenatals dont have it in them and i couldnt find any that did. But i did find magnesium. So i see my dr in a week but in the meantime, how much were you taking? And was it otc?