Correcting migration SQL