Updated Asset migration task
MODIFY
src/migration/tasks/AddSiteIDToAssetTask.ts
src/migration/tasks/AddSiteIDToAssetTask.ts
@@ -35,6 +35,18 @@ export default class AddSiteIDToAssetTask extends MigrationTask {
);
modifiedCount += result.modifiedCount;
}
+ // Delete siteIDs for assets without site area
+ const result = await global.database.getCollection(tenant.id, 'assets').updateMany(
+ {
+ siteAreaID: null,
+ },
+ {
+ $set: {
+ siteID: null,
+ }
+ }
+ );
+ modifiedCount += result.modifiedCount;
// Log in the default tenant
if (modifiedCount > 0) {
await Logging.logDebug({

Updated Asset migration task