I have two different definitions of a relative effective Cartier divisor. The first one is a bit outdated and defines the notion over analytic spaces, in the following way:
Definition 1:
Let $X$ be a smooth projective curve and $T$ an analytic space. A relative effective Cartier divisor on $X$ over $T$ is simply an effective Cartier divisor on the product $X\times T$ which does not contain any fiber of the projection $ X\times T \to T $.
The second definition is more modern (can be found for instance in the Stack project), and defines the notion over schemes:
Definition 2:
Let $S$ be a scheme and $X$, $T$ be schemes over $S$. A relative effective Cartier divisor on $X\,/\,T$ is a closed subscheme $D\subset X$ together with a flat morphism $f:D\to T$, such that the ideal sheaf $\mathcal{I}_D$ of $D$ is invertible.
Now, I'd like to understand the relashionship between the two definitions. I'm more interested in the modern, scheme-theoretic one and in particular I'd like to see if a $D$ as in definition 2 can be thought as a divisor on the fibred product $X\times T$ over $S$.
What I did so far is the following: we can write down the pullback diagram defining the fibered product and, using the given $f:D\to T$ and the inclusion $i:D\to X$ (how can I see the diagram commutes?) we get the dashed arrow.

Should I think of the dashed morphism as the inclusion of $D$ as a codimension $1$ subscheme of $X\times T$ ?
And, further, is it possible to show that the resulting divisor on $X\times T$ does not contain any fiber of the projection, as in definition 1?
I have the sketch of a solution, but please help me to improve it. $\newcommand{\O}{\mathcal{O}}$ $\newcommand{\I}{\mathcal{I}}$ $\newcommand{\SES}[3]{0\to #1 \to #2 \to #3 \to 0}$ $\DeclareMathOperator{\spec}{Spec}$
Let's make the following assumptions:
Notice that in this setting we have $\O_{X\times T} = \O_X \otimes_k \O_T$.
Now let $F$ be the fiber of a given $t\in T$, i.e. $\O_F=\O_X\otimes_k k(t)$, where $K(t)$ is the residue field of $T$ at the point $t$.
We have an exact sequence of $\O_T$-modules $$ \SES{\I_F}{\O_{X\times T}}{\O_F} $$ and applying the functor $\square \otimes_{\O_T} \O_D$ (which is exact by the flatness hypothesis) we get the exact $$ \SES{\I_F \otimes_{\O_T} \O_D}{\O_{X\times_k T} \otimes_{\O_T} \O_D}{\O_F \otimes_{\O_T} \O_D}. $$ Now, because of the identity $$ \O_{X\times T} \otimes_{\O_T} \O_D = \O_X \otimes_k \O_T \otimes_{\O_T} \O_D = \O_X \otimes_k \O_D = \O_D $$ we can rewrite the above sequence as $$ \SES{\I_{F\cap D}}{\O_D}{\O_F \otimes_{\O_T} \O_D}, $$ so we see that $\O_{F\cap D} = \O_F \otimes_{\O_T} \O_D$. Hence we find $$ F\cap D = \spec(\O_F \otimes_{\O_T} \O_D) = F\times_T D \neq F\quad \implies \quad F \not\subset D, $$ i.e. no fiber of the projection is contained in $D$, as we wanted.