Fix upgrade SQL

Cleaned up SQL updates to go from 3.0 -> 4.0

Part of ongoing work for #1188