How to fix Nextcloud upgrade Migration step '...' is unknown


When upgrading your Nextcloud instance, you see an error message like

Migration step 'OCA\Files\Migration\Version11301Date20191205150729' is unknown


This error occurs because you just copied over multiple versions of the apps directory, which resulted in

First, make a backup of your apps directory(located inside your Nextcloud folder).

Then delete your current apps directory and replace it by the apps directory from the new version of Nextcloud you want to upgrade to.

After that, retry the upgrade.