Server: Option to clean up data from an app when disabling it aka. "Uninstall for apps"

Created on 3 Aug 2017  Â·  6Comments  Â·  Source: nextcloud/server

Just came across this in https://github.com/nextcloud/server/issues/5811 again.

The issue is the app was enabled in the past. It's now disabled and not used anymore.
Since the app is not enabled, updates are not executed.
Since updates are not executed, the table can not be migrated to mb4.
Since the repair fails, the update is incomplete.

Depending on when the app was disabled, the available update steps might even be too little (thanks migrations this will hopefully be solved some day). So the update could fail as well.

Also with regards to the new AppData stuff I think we should have a Remove app data for disabled apps. That would trigger an uninstall script/migration and apps should make sure to:

  1. Delete their db tables and columns
  2. Remove appconfig, config, preferences, shares, systemtags, comments, ...
  3. Remove their data from the data directory

Opinions @MorrisJobke @LukasReschke @rullzer

1. to develop enhancement apps management technical debt

Most helpful comment

Please don't forget to clean up the migration table. There are some issues regarding to that, where admins removed the app tables from the database and did not remove the app related migration entries.

So, after a new install, the tables did not get created or updated.

i.e. https://github.com/nextcloud/polls/issues/460

All 6 comments

Also with regards to the new AppData stuff I think we should have a Remove app data for disabled apps. That would trigger an uninstall script/migration and apps should make sure to:

The question is when this should be called. Because we should definitely not call it on app disabling. Because then if an app is incompatible it will kill all it's content.

No, I would add a new occ for this and add a new button for disabled apps in the ui

Related: #5539 (where this was requested for when the admin decides to completely remove an app). Which a.o. suggests something like occ app:remove (remove the app including its database tables, files, directories etc), occ app:prune or occ app:reset (reset database (and configuration) to a state as if the app was just installed now).

PS: It would also need something to detect tables from removed apps. I have some instances I am using since OC7, and some had apps like Contacts+/Calendar+ which long ago were "abandoned" and never available for Nextcloud. Still, while their files are gone by the way of a manual upgrade, their database contents still exist. Which IMHO asks for something like occ db:get-orphaned-tables – and maybe something similar for wherever else apps might leave data (registration/configuration and the like).

Please don't forget to clean up the migration table. There are some issues regarding to that, where admins removed the app tables from the database and did not remove the app related migration entries.

So, after a new install, the tables did not get created or updated.

i.e. https://github.com/nextcloud/polls/issues/460

Well there are more things that are related: appconfig, preferences, etc.
Which is why the apps should have an option to take care of it too, but we clean some defined default places.

Was this page helpful?
0 / 5 - 0 ratings