Delete obsolete app table?

Hello,

is there a way to delete a table which is not used within my app anymore?
Removing it from database.xml obviously leaves it in the DB.
Migrations are only available as of NC13.

what would be the correct way for some cleanup?

1 Like

Asked myself the same question several times. There should be some cleanup command for this.

i would go with a repair-step and a RequestBuilder to drop the table.

Yeah, seethe 2FA backup code app:

Or in 13+ you use migrations:

For more information on migrations see:
https://www.schilljs.com/2017/09/08/migrations-for-nextcloud-apps.html

hello,
thank you für this reference. this fits our needs perfectly.
Can you explain how this migration script is being executed/triggered?

I thought about some lines in the PageController, but here seems to be a proper process for this.

thank you

Just found it.
can be triggered via index.xml

https://github.com/nextcloud/server/blob/stable12/apps/twofactor_backupcodes/appinfo/info.xml#L28

Well thats for repair steps and should not be necessary for these migrations.
You just need to increment the version of your app, so it checks for the schema migrations.

Hello,

but incrementing the version does not delete a table which is not in the database.xml anymore.
so we need this step to delete it - isn´t it?

yes

Post must be at least 10 characters