Delete a tenant

On our radar

It would be great if we could have a tenant delete function. I know this isn't an easy thing to ask due to the way Outsystems does it's database with referential constraints and a view per entity per tenant however there are things that could be done.

For example a script to take the results of 

select * from  sys.views where name like '%T36'

Feed that to a delete statement that skips on an error and moves to the next record. Then repeat the entire thing until all errors are gone. This would basically skip each table that has a referential error and delete all those that dont. Then repeat which would now be able to delete a few more, and again until eventually all tenant data should be gone. After that the tenant views could be dropped.

It's a brute force way of doing things but should allow the full deletion of a tenants data as long as you don't have any single tenant entities pointing to multi tenant ones.

Created on 15 Nov 2018
Comments (3)

Changed the category to Backend and the status to

On our radar

Hi John,

First of all, thank you for your idea and contribution.

In order to better understand the big picture here, can you tell us why do you feel the need to delete a tenant? What are the use case that you want to cover with this ability to delete a tenant? Did something happen in product that made you think that deleting a tenant will solve the problem?


No nothing like that. We have a few different reasons for wanting to delete a tenant. The main ones being 

1) Our terms and conditions with our clients are such that we need to guarantee the complete removal of all their data should they cancel our services

2) Should a client leave our service we wish to reclaim the database storage used by them

3) In our dev and testing environments we often create tenants, and populate with test data. This then occasionally needs to be cleared otherwise we end up with a lot of stale data and tenants

I would think that both these conditions would be fairly common to anyone that is creating a multi tenant system used by external clients.

Any news on this? 

We have the same issues,  and like to know how to delete tenants