Use strings instead of integers for migration version numbers

- Allows timestamp versions to work on 32-bit systems.
- Fixes #2902.
- Supersedes PR #2368.