Simplify and speed up migrations by using raw SQL