just an update, the syntax for the psql variables has changed, so the conversion script looks like this:
sudo -u www-data php occ db:convert-type \
--password ${CLOUDRON_POSTGRESQL_PASSWORD} \
--clear-schema --all-apps pgsql \
${CLOUDRON_POSTGRESQL_USERNAME} \
${CLOUDRON_POSTGRESQL_HOST} \
${CLOUDRON_POSTGRESQL_DATABASE}
you must run this from within the nextcloud container.
also, I had some dificulties with the mysql migration, the temp mariadb/mysql docker container should match the same type and version as the source. In my case src had mariadb 10.5, so the container from the code sample above (mariadb 10.1) throw some strange errors while importing the sql dump.