Add to_2d SQL function in migration