mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-30 12:18:11 +00:00
35 lines
1.2 KiB
TypeScript
35 lines
1.2 KiB
TypeScript
import { MigrationInterface, QueryRunner } from 'typeorm';
|
|
|
|
/**
|
|
* Hazardous contracts now declare WHAT the dangerous good is, not just that it
|
|
* exists: the UN/ADR class (CLASS_1..CLASS_9) and the shipment's UN number. Both
|
|
* are captured in the portal alongside the hazard documents and reviewed by the
|
|
* two hazardous approval desks.
|
|
*
|
|
* Nullable — non-hazardous contracts leave both null, and contracts created
|
|
* before this change have no declaration to backfill.
|
|
*/
|
|
export class AddContractHazardDeclaration2960000000000
|
|
implements MigrationInterface
|
|
{
|
|
name = 'AddContractHazardDeclaration2960000000000';
|
|
|
|
public async up(queryRunner: QueryRunner): Promise<void> {
|
|
await queryRunner.query(
|
|
`ALTER TABLE freight.contracts ADD COLUMN IF NOT EXISTS hazard_class varchar(16);`,
|
|
);
|
|
await queryRunner.query(
|
|
`ALTER TABLE freight.contracts ADD COLUMN IF NOT EXISTS un_number varchar(16);`,
|
|
);
|
|
}
|
|
|
|
public async down(queryRunner: QueryRunner): Promise<void> {
|
|
await queryRunner.query(
|
|
`ALTER TABLE freight.contracts DROP COLUMN IF EXISTS un_number;`,
|
|
);
|
|
await queryRunner.query(
|
|
`ALTER TABLE freight.contracts DROP COLUMN IF EXISTS hazard_class;`,
|
|
);
|
|
}
|
|
}
|