Restore from old version to a new version of discourse failed

Did you try to restore a different backup this time?

Also, can you take a look at the dump.sql file? It should contain something like -- Dumped by pg_dump version 9.5.12 in the first couple of lines.