Destroying instance DBs for an app before it is deleted.
This commit is contained in:
parent
5c7baf84c3
commit
65a2da9091
|
@ -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,
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue