Migrating data from a 23.0.3 to a 24+ server

I have an existing nextcloud server running 23.0.3. Upgrading it to the newest version has been problematic (not me doing it but another admin).

I’m looking to get nextcloud running on my nixos server and migrate the data over. On nixos versions 24, 25, and 26 are available.

Is it possible to install 24 on my new machine and then load the pg_dump from 23 onto it? (along with the data files) Will it automatically upgrade?

Or, will I need to figure out a way to get 23 running and then upgrade after. Would rather avoid this option.

I think for a direct restore you would need to be running the exact same version and then upgrade. Unless you can trigger the upgrade on first launch. I’m not sure about that because I only really run the Docker versions.

You don’t only need the database, by the way. You should copy the entire web root also and make sure to maintain permissions and timestamps.