wrapping upgrade migration in prepare statement