Pregnancy related or no?

I woke up at 5am this morning feeling sooo nauseous...it ended up turning into awful diarrhea and that feeling of being in the verge of throwing up for hours. I can’t even drink a sip of water. I am occasionally getting some uncomfortableness and cramping in my stomach. Is all this pregnancy related (31 weeks) or have I just come down with some gastro bug?