1
0
Fork 0
mirror of synced 2024-06-20 19:30:28 +12:00

Destroying instance DBs for an app before it is deleted.

This commit is contained in:
mike12345567 2020-10-13 16:31:14 +01:00
parent 4ea99592d9
commit 407d7606e9

View file

@ -116,6 +116,12 @@ exports.delete = async function(ctx) {
const db = new CouchDB(ClientDb.name(getClientId(ctx)))
const app = await db.get(ctx.params.applicationId)
const result = await db.remove(app)
for (let instance of app.instances) {
const instanceDb = new CouchDB(instance._id)
await instanceDb.destroy()
}
// remove top level directory
await fs.rmdir(join(budibaseAppsDir(), ctx.params.applicationId), {
recursive: true,
})