Also, your sol2 seems to use the assumptions after the actual integration. This seems to work better:
Integrate[Sin[n*Pi*x]*Sin[m*Pi*x], {x, 0, 1}, Assumptions -> {m \[Element] Integers, n \[Element] Integers, m == n}]
This is largely a duplicate of a thread from last year.