mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-29 14:08:11 +00:00
Added assertCapacity() checks before saving (matches single receive) Added applyCapacityDelta() after save to increment counters Now validates warehouse → yard → zone capacity hierarchy Single receive already had both checks; bulk receive was gap.
23 lines
753 B
TypeScript
23 lines
753 B
TypeScript
import { MigrationInterface, QueryRunner } from 'typeorm';
|
|
|
|
/**
|
|
* Dedup stamp for the km/date-due maintenance alert — without it the daily
|
|
* cron would re-notify every day a schedule stays due.
|
|
*/
|
|
export class AddMaintenanceDueNotifiedAt2480000000000 implements MigrationInterface {
|
|
name = 'AddMaintenanceDueNotifiedAt2480000000000';
|
|
|
|
public async up(queryRunner: QueryRunner): Promise<void> {
|
|
await queryRunner.query(`
|
|
ALTER TABLE freight.maintenance_schedules
|
|
ADD COLUMN IF NOT EXISTS due_notified_at timestamptz NULL
|
|
`);
|
|
}
|
|
|
|
public async down(queryRunner: QueryRunner): Promise<void> {
|
|
await queryRunner.query(`
|
|
ALTER TABLE freight.maintenance_schedules DROP COLUMN IF EXISTS due_notified_at
|
|
`);
|
|
}
|
|
}
|