How to restore a domain, an application, a data asset or an attribute?

When a domain, an application, a data asset or an attribute are deleted by the users through sidecar application (and no through other channel such as SQL), the object is logically deleted "soft delete", the column SYS_IsDeleted is set to 1

There are two ways to restore an object:

Automatically restore an object and all associated items

A stored procedure [dbo].[sp_Recover_Hierarchy] is available to help you restore an entire hierarchy deleted by the users. A hierarchy could be a domain and all associated applications, data assets and attributes. You can restore the entire hierarchy or only a portion of it.

  • Stored procedure : [dbo].[sp_Recover_Hierarchy]

  • Input parameter :

    • @ObjectId as integer, Id of the object to restore (Id of the domain for example)

    • @ObjectType as varchar, Type of the object 'Domain' or 'Application' or 'Data_Asset'

    • @DeleteSub as int, 0 to recover only this level (ex: domain), 1 to recover all applications, data assets and attributes under this domain or the object

Here is an example of how to restore the application "Patient Manager" (id=1) and all data assets and attributes associated

Exec [dbo].[sp_Recover_Hierarchy] @ObjectId=1, @ObjectType='Application', @DeleteSub=0

You can check the results in the table [dbo].[Audit_Delete]

Manually restore one object

The second way to restore an object is to update the table directly. You need to set the field of the wanted object to [SYS_IsDeleted] = 0 .

This logic applies to all domains, applications, data assets or attributes.

Example of a query to restore a domain:

update [dbo].[Domain]

set [SYS_IsDeleted] = 0

where [Domain_Name] = 'Your domain name'