Is this only after a big organized ride or does it also happen after long training rides?

I take daily meds to prevent migraines but that's because they were occurring daily. For occasional migraines, that wouldn't be recommended. I sometimes get headaches after a long ride but not migraines.