Backup and restoring Multi-Tenant sites


We are developing a multi-tenant application. The data that is stored for one tenant is not visible to other tenant.

I need advice on how we can backup/restore data per tenant.
Hi Derrick,

You would usually handle backup and restore on database level (outside the platform), not per tenant. But if you want to do some automated backup, why not start a timer for each tenant that does the backing up?

HI Kilian

If we had to restore a single tenant, without overwriting other tenant information, how would you suggest we do that? Also, how would you suggest we backup a single tenant
Hi Derrick,

I can see your problem. I have honestely no idea what OutSystems vision is on that. Since the tenant is just an Id in a table, I think it's virtually impossible to back-up and restore a single tenant, especially with more complex data models.
Hi Derrick,

When designing your data model don't forget you can also have single-tenant entities. Not all entities are multi-tenant, as you can set the property "Is Multitenant" to No. And those are probably the ones that you want to backup/restore for that specific tenant.

Anyway, I don't know what is the OutSystems recommended way of doing it - would like to know.
Hi Derrick,

Personally I would consider backup-restore in a Multi-Tenant application to be a disaster recovery process only i.e. a catastophic event that affected all of your tenants.

I would focus on making your application idiot-proof so an individual tenant cannot corrupt their own data. If you have to provide a roll-back type of functionality maybe you could keep a detailed transaction audit trail in multi-tenant enabled entities which (in theory) would give the tenant the ability to 'undo' recent changes.  If you search 'History' in the Forge you will find a couple of components that perform entity history versioning although more targeted at compliance than roll-back requirements.

I don't know your circumstances so the above may be off the mark but hope it gives you something to think about.

I would also like to here OutSystems thoughts.

You would need a very sophisticated backup/restore solution that is able to filter what is being restored based on the actual record information. I am not aware of anything like that.

The alternative would be to depend on the tenant views to back up data separately on a per-tenant basis using a serialized, ETL, etc. style process.

Restoring the data would be the issue.  Any ID that is autonumber would require preserving that number if the record you are trying to restore was deleted or finding every link to the record and fixing the links.  I know of no Outsystems way of doing this so you'd have to write a fairly sophisticated extension, if it can be done at all.  Now factor in that some entities are single tenant and you have an even more complicated problem.

Even with the transaction log method described above, deletion of records will always be an issue.  That's why many people use the IsActive flag and literally never delete a record.  Your application would have to implement that for all entities and never actually delete records for any restore process to work.