Files
cariflex/tools/citrineos-core-main/apps/Server/migrations/20260205150000-add-latest-ocpp-message-timestamp.ts
Eric F d398a6ced2 Add extracted tools: CitrineOS, OpenOCPP, ShapeShifter
- CitrineOS core extracted (CSMS OCPP 2.0.1)
- OpenOCPP extracted (firmware OCPP 1.6J/2.0.1)
- ShapeShifter library installed (pip install -e)
- ShapeShifter specification extracted
- EVerest extracted

TODO updated with progress
2026-06-08 00:38:27 -04:00

33 lines
1.1 KiB
TypeScript

// SPDX-FileCopyrightText: 2026 Contributors to the CitrineOS Project
//
// SPDX-License-Identifier: Apache-2.0
import { QueryInterface, DataTypes } from 'sequelize';
/**
* Migration to add latestOcppMessageTimestamp.
*/
export async function up(queryInterface: QueryInterface): Promise<void> {
// Add new latestOcppMessageTimestamp column
await queryInterface.addColumn('ChargingStations', 'latestOcppMessageTimestamp', {
type: DataTypes.DATE,
allowNull: true,
});
// Add index on latestOcppMessageTimestamp for efficient staleness queries
await queryInterface.addIndex('ChargingStations', ['latestOcppMessageTimestamp'], {
name: 'idx_charging_stations_latest_ocpp_message_timestamp',
});
}
export async function down(queryInterface: QueryInterface): Promise<void> {
// Remove index
await queryInterface.removeIndex(
'ChargingStations',
'idx_charging_stations_latest_ocpp_message_timestamp',
);
// Remove latestOcppMessageTimestamp column
await queryInterface.removeColumn('ChargingStations', 'latestOcppMessageTimestamp');
}