Migration - only modify site id, if siteAreaID exists
MODIFY
src/migration/tasks/AddSiteIDToAssetTask.ts
src/migration/tasks/AddSiteIDToAssetTask.ts
@@ -38,7 +38,10 @@ export default class AddSiteIDToAssetTask extends MigrationTask {
// Delete siteIDs for assets without site area
const result = await global.database.getCollection(tenant.id, 'assets').updateMany(
{
- siteAreaID: null,
+ siteAreaID: {
+ $exists: true,
+ $eq: null
+ }
},
{
$set: {

MODIFY
src/migration/tasks/AddSiteIDToChargingStationTask.ts
src/migration/tasks/AddSiteIDToChargingStationTask.ts
@@ -39,7 +39,10 @@ export default class AddSiteIDToChargingStationTask extends MigrationTask {
// Delete siteIDs for charging stations without site area
const result = await global.database.getCollection(tenant.id, 'chargingstations').updateMany(
{
- siteAreaID: null,
+ siteAreaID: {
+ $exists: true,
+ $eq: null
+ }
},
{
$set: {

Migration - only modify site id, if siteAreaID exists