Clean Up Versions
This article explains how to permanently remove Customers, Versions, and all their associated metadata from the BimlFlex database using the [wcf].[SetDeleteCustomerVersion] stored procedure.
This stored procedure permanently deletes data from your BimlFlex database. This operation:
- Cannot be undone without restoring from a database backup
- Removes all metadata associated with the targeted Customer and Version
- Affects both
[app]schema tables and[archive]schema tables (when enabled) - Should only be executed by database administrators with proper authorization
- Data is permanently removed - there is no recycle bin or soft-delete recovery
Always create a full database backup before running this procedure.
Overview
The BimlFlex application does not provide functionality to delete Customers or Versions through the user interface. The [wcf].[SetDeleteCustomerVersion] stored procedure is the supported method for permanently removing this data.
Common scenarios for using this procedure:
- Removing training environments that are no longer needed
- Cleaning up temporary backup copies of metadata
- Deleting test or development versions after use
- Removing an entire Customer and all associated Versions
Procedure Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
@CustomerUID | NVARCHAR(40) | Required | The UID of the Customer |
@VersionName | NVARCHAR(128) | Required | The name of the Version to delete |
@UserName | NVARCHAR(100) | NULL | Optional username for audit purposes (defaults to current user) |
@ForceDelete | BIT | 0 | Reserved for future use |
@DeleteArchive | BIT | 0 | Set to 1 to also delete records from archive tables |
@DeleteVersion | BIT | 0 | Set to 1 to delete the Version record itself |
@DeleteCustomer | BIT | 0 | Set to 1 to delete the Customer record (requires @DeleteVersion = 1) |
Prerequisites
1. Create a Full Database Backup (Recommended)
BACKUP DATABASE [BimlFlex]
TO DISK = N'C:\Backups\BimlFlex_PreCleanup.bak'
WITH FORMAT, INIT, NAME = N'BimlFlex - Pre-Cleanup Backup', COMPRESSION;
2. Identify the Customer UID and Version Name
SELECT [CustomerUID]
,[Customer]
,[VersionUID]
,[Version]
FROM [app].[VersionDetail];
Usage Examples
Delete Version Metadata Only (Keep Version Record)
Removes all metadata for the specified Version but keeps the Version record:
EXEC [wcf].[SetDeleteCustomerVersion]
@CustomerUID = 'your-customer-uid-here',
@VersionName = 'TRAINING_Demo_20240115';
Delete Version and All Its Metadata
Removes the Version record and all associated metadata:
EXEC [wcf].[SetDeleteCustomerVersion]
@CustomerUID = 'your-customer-uid-here',
@VersionName = 'TRAINING_Demo_20240115',
@DeleteVersion = 1;
Delete Version Including Archive Data
Removes the Version, all metadata, and all archive history:
EXEC [wcf].[SetDeleteCustomerVersion]
@CustomerUID = 'your-customer-uid-here',
@VersionName = 'TRAINING_Demo_20240115',
@DeleteArchive = 1,
@DeleteVersion = 1;
Delete Customer and Version Completely
Removes the Customer, Version, all metadata, and all archive history. The Customer is only deleted if no other Versions or metadata remain for that Customer:
EXEC [wcf].[SetDeleteCustomerVersion]
@CustomerUID = 'your-customer-uid-here',
@VersionName = 'LastVersionForCustomer',
@DeleteArchive = 1,
@DeleteVersion = 1,
@DeleteCustomer = 1;
What the Procedure Deletes
The procedure removes records from these tables for the specified Customer and Version:
| Category | Tables |
|---|---|
| Core Configuration | Connections, Batches, Projects, Configurations, Settings, UserSettings |
| Schema & Objects | Schemas, Objects, Columns, Parameters |
| Mappings | DataTypeMappings |
| Extensions | ExtensionPoints, CustomAttributes, Macros |
| Business Modeling | BusinessModels, BusinessModelConfigurations, BusinessModelEntities, BusinessEntities, BusinessEntityTypes, BusinessSubjects, BusinessAttributes, BusinessRelationships, BusinessClassifications, BusinessDomains, BusinessTags |
| Azure Data Factory | AdfLinkedServices |
If you accidentally delete needed metadata, restore from your backup:
RESTORE DATABASE [BimlFlex]
FROM DISK = N'C:\Backups\BimlFlex_PreCleanup.bak'
WITH REPLACE, RECOVERY;