How to split configuration and data?

Configuration details

Nextcloud version (eg, 20.0.5): 21
Operating system and version (eg, Ubuntu 20.04): official docker container

The issue you are facing:

This is not an issue but a configuration question.

Is there a way to configure Nextcloud so that the actual files are stored in a separate directory, while leaving the configuration and database information somewhere else?

The rationale would be that the “data” files are immutable between upgrades (successful and failed :)) and recovering the configuration and database is much faster if the actual user files are not part of the recovery.

I thought that the data directory could be the one to store separately (or - not recover when something goes wrong,g) but I am afraid that owncloud.db is closely connected with the installation and its version. Is this the case?

EDIT: I recovered a failed install with the data folder excluded and it worked. I would be glad to have a confirmation about the database relationship to the installation (and especially its version)