Files
edr-platform/apps/edr-freight-api/src/migrations/2120000000000-AddLastMileProofOfDelivery.ts
Hagernesh 4e8d35a7fb Warehouse zone occupancy heatmap
Visualize live per-zone occupancy on the warehouse detail page.
2026-07-13 12:09:43 +00:00

35 lines
1.2 KiB
TypeScript

import { MigrationInterface, QueryRunner } from "typeorm";
/**
* Proof of delivery for EDR last-mile: recipient name, a captured signature
* (stored as a file), delivery photos (file ids), notes, and the capture time.
* Recorded when the driver completes the delivery.
*/
export class AddLastMileProofOfDelivery2120000000000
implements MigrationInterface
{
name = "AddLastMileProofOfDelivery2120000000000";
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`
ALTER TABLE freight.last_mile
ADD COLUMN IF NOT EXISTS pod_recipient_name varchar(160),
ADD COLUMN IF NOT EXISTS pod_signature_file_id uuid,
ADD COLUMN IF NOT EXISTS pod_photo_file_ids text[] NOT NULL DEFAULT '{}',
ADD COLUMN IF NOT EXISTS pod_notes text,
ADD COLUMN IF NOT EXISTS pod_captured_at timestamptz
`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`
ALTER TABLE freight.last_mile
DROP COLUMN IF EXISTS pod_recipient_name,
DROP COLUMN IF EXISTS pod_signature_file_id,
DROP COLUMN IF EXISTS pod_photo_file_ids,
DROP COLUMN IF EXISTS pod_notes,
DROP COLUMN IF EXISTS pod_captured_at
`);
}
}