Lemma 31.11.7. Let $f : X \to Y$ be a flat morphism of schemes. If $Y$ is integral and the generic fibre of $f$ is integral, then $X$ is integral.

Proof. The algebraic analogue is this: let $A$ be a domain with fraction field $K$ and let $B$ be a flat $A$-algebra such that $B \otimes _ A K$ is a domain. Then $B$ is a domain. This is true because $B$ is torsion free by More on Algebra, Lemma 15.22.9 and hence $B \subset B \otimes _ A K$. $\square$

In your comment you can use Markdown and LaTeX style mathematics (enclose it like $\pi$). A preview option is available if you wish to see how it works out (just click on the eye in the toolbar).