Ref T13242. See https://discourse.phabricator-community.org/t/out-of-range-value-for-column-deviceversion/2218.
The synchronization log column is uint32? and -1 doesn't go into that column.
Since we're only using -1 for convenience to cheat through $max_version > $this_version checks, use null instead and make the checks more explicit.