performance improvment for MigrationVersion.compareTo

move logic of parsing to construction phase and make some reusing of
cached patterns