The tests are done by creating each version of the database from scratch, using the appropriate SQL file, then dumping the resulting database with pg_dump. Then the code recreates each version and runs the migrations from that version to the max version, comparing the output of pg_dump after each migration.