Skip to main content

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.

Critical Warning - Destructive Operation

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

ParameterTypeDefaultDescription
@CustomerUIDNVARCHAR(40)RequiredThe UID of the Customer
@VersionNameNVARCHAR(128)RequiredThe name of the Version to delete
@UserNameNVARCHAR(100)NULLOptional username for audit purposes (defaults to current user)
@ForceDeleteBIT0Reserved for future use
@DeleteArchiveBIT0Set to 1 to also delete records from archive tables
@DeleteVersionBIT0Set to 1 to delete the Version record itself
@DeleteCustomerBIT0Set to 1 to delete the Customer record (requires @DeleteVersion = 1)

Prerequisites

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:

CategoryTables
Core ConfigurationConnections, Batches, Projects, Configurations, Settings, UserSettings
Schema & ObjectsSchemas, Objects, Columns, Parameters
MappingsDataTypeMappings
ExtensionsExtensionPoints, CustomAttributes, Macros
Business ModelingBusinessModels, BusinessModelConfigurations, BusinessModelEntities, BusinessEntities, BusinessEntityTypes, BusinessSubjects, BusinessAttributes, BusinessRelationships, BusinessClassifications, BusinessDomains, BusinessTags
Azure Data FactoryAdfLinkedServices
Recovery Option

If you accidentally delete needed metadata, restore from your backup:

RESTORE DATABASE [BimlFlex]
FROM DISK = N'C:\Backups\BimlFlex_PreCleanup.bak'
WITH REPLACE, RECOVERY;