removed all phaes migration
MODIFY
src/migration/MigrationHandler.ts
src/migration/MigrationHandler.ts
@@ -25,7 +25,6 @@ import { ServerAction } from '../types/Server';
import SiteUsersHashIDsTask from './tasks/SiteUsersHashIDsTask';
import UpdateChargingStationStaticLimitationTask from './tasks/UpdateChargingStationStaticLimitationTask';
import UpdateChargingStationTemplatesTask from './tasks/UpdateChargingStationTemplatesTask';
-import UpdateConsumptionsAmpsToAllPhases from './tasks/UpdateConsumptionAmpsToAllPhasesTask';
import UpdateConsumptionsToObjectIDs from './tasks/UpdateConsumptionsToObjectIDs';
import UpdateLimitsInConsumptionsTask from './tasks/UpdateLimitsInConsumptionsTask';
import cluster from 'cluster';
@@ -73,7 +72,6 @@ export default class MigrationHandler {
currentMigrationTasks.push(new AddSiteAreaLimitToConsumptionsTask());
currentMigrationTasks.push(new AddInstantAmpsToConsumptionsTask());
currentMigrationTasks.push(new MigrateOcpiTransactionsTask());
- currentMigrationTasks.push(new UpdateConsumptionsAmpsToAllPhases());
currentMigrationTasks.push(new UpdateChargingStationStaticLimitationTask());
currentMigrationTasks.push(new UpdateChargingStationTemplatesTask());
// CurrentMigrationTasks.push(new UpdateLimitsInConsumptionsTask());

DELETE
src/migration/tasks/UpdateConsumptionAmpsToAllPhasesTask.ts
-import Constants from '../../utils/Constants';
-import Logging from '../../utils/Logging';
-import MigrationTask from '../MigrationTask';
-import { ServerAction } from '../../types/Server';
-import Tenant from '../../types/Tenant';
-import TenantStorage from '../../storage/mongodb/TenantStorage';
-import global from '../../types/GlobalType';
-
-const MODULE_NAME = 'UpdateConsumptionsAmpsToAllPhases';
-
-export default class UpdateConsumptionsAmpsToAllPhases extends MigrationTask {
- async migrate() {
- const tenants = await TenantStorage.getTenants({}, Constants.DB_PARAMS_MAX_LIMIT);
- for (const tenant of tenants.result) {
- await this.migrateTenant(tenant);
- }
- }
-
- async migrateTenant(tenant: Tenant) {
- let modifiedCount = 0;
- const result = await global.database.getCollection(tenant.id, 'consumptions').updateMany(
- {
- limitWatts: { $exists: true },
- limitAmps: { $ne: { $round: [{ $divide: ['$limitWatts', 230] }] } },
- },
- [
- { '$set': { 'limitAmps': { '$round': [{ '$divide': ['$limitWatts', 230] }] } } }
- ]
- );
- modifiedCount += result.modifiedCount;
- // Log in the default tenant
- if (modifiedCount > 0) {
- Logging.logDebug({
- tenantID: Constants.DEFAULT_TENANT,
- action: ServerAction.MIGRATION,
- module: MODULE_NAME, method: 'migrateTenant',
- message: `${modifiedCount} Consumptions have been updated in Tenant '${tenant.name}'`
- });
- }
- }
-
- getVersion() {
- return '1.0';
- }
-
- getName() {
- return 'UpdateConsumptionsAmpsToAllPhases';
- }
-
- isAsynchronous() {
- return true;
- }
-}

removed all phaes migration