mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-28 19:30:57 +00:00
35 lines
1.2 KiB
TypeScript
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
|
|
`);
|
|
}
|
|
}
|