I was trying to debug my practice app “drpc” when I ran into an additional problem with trying to update/change the name of the table in the database.
I never got passed this issue:
sudo -u www-data php ./occ app:enable drpc
PHP Fatal error: Cannot declare class OCA\DRpc\Migration\Version1401Date2022073019240000, because the name is already in use in /var/www/nextcloud/apps/drpc/lib/Migration/Version1401Date20220730192400.php on line 10
I tried various ways to get rid of all traces of my app in various ways,
- Removed from filesystem.
- Droped the tables in the database
… but I couldn’t restart my development - so I ended up re-installing nextcloud again. This is massively tedious, to I’m curious about how you create an efficient workflow when developing an app.
I mean - how do I remove an app completely (including all migrations etc.) to then add it back to test changes in the development?
So the issue seems that you have two files including the same class name, when you try to enable the app it will detect the two files with the same name and for good reasons complaints.
To remove the migrations, you probably want to delete all the related rows in the oc_migrations table, to deinstall the app, you need to do the same in the oc_appconfig table.
Out of curiosity one question: Have you by chance installed the app twice?
I had the case once that I thought, my app would be installed in
custom_apps/cookbook, while the
occ app:enable downloaded a completely new version to
The error you are quoting does not say that the DB is broken but that there are two classes claiming the same name and both have been visited by the class loader for whatever reason. Have a look at the NC installation. Search all files for
Version1401Date2022073019240000. You will eventually find two files.
Thanx for the help, but after some code cleanup - it was resolved. Thanx for helping out! Appreciate it.