mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-30 06:28:12 +00:00
fix(bookings): gate export carriage acceptance sheet on GRN receipt
The sheet attests EDR has taken custody. Export custody happens at warehouse receipt, so the shared received-with-GRN gate now runs even when wagons are already allocated. Receipt-row query also accepts the legacy notes GRN fallback, matching the loading gate.
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
import { MigrationInterface, QueryRunner } from 'typeorm';
|
||||
|
||||
export class EmptyContainerReturnStatusHistory3220000000000 implements MigrationInterface {
|
||||
name = 'EmptyContainerReturnStatusHistory3220000000000';
|
||||
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`
|
||||
ALTER TABLE freight.empty_container_returns
|
||||
ADD COLUMN IF NOT EXISTS status_history jsonb NOT NULL DEFAULT '[]'::jsonb
|
||||
`);
|
||||
await queryRunner.query(`
|
||||
UPDATE freight.empty_container_returns
|
||||
SET status_history = jsonb_build_array(
|
||||
jsonb_build_object('status', status, 'changedAt', created_at, 'performedBy', performed_by)
|
||||
)
|
||||
WHERE status_history = '[]'::jsonb
|
||||
`);
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`
|
||||
ALTER TABLE freight.empty_container_returns
|
||||
DROP COLUMN IF EXISTS status_history
|
||||
`);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user