I have several installs of Postgres / PostGIS, version 9.4 up to and including 9.6. I would like to upgrade all the databases (maybe 20 total) in the various installs to a single install of the current version.

How do I migrate the databases to the current version? Do I just backup each database in situ, restore in the new PG instance and then upgrade the PostGIS extension (like `ALTER EXTENSION postgis UPDATE TO "2.3.1";`)? Any other steps?