mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-28 16:00:56 +00:00
29 lines
950 B
TypeScript
29 lines
950 B
TypeScript
import { MigrationInterface, QueryRunner } from "typeorm";
|
|
|
|
/**
|
|
* Add code, power_plate_no and trailer_plate_no columns to vehicles.
|
|
* These fields existed in the DTO and UI form but had no entity columns,
|
|
* so submitted values were silently dropped.
|
|
*/
|
|
export class AddVehicleCodeAndPlates1890000000001 implements MigrationInterface {
|
|
name = "AddVehicleCodeAndPlates1890000000001";
|
|
|
|
public async up(queryRunner: QueryRunner): Promise<void> {
|
|
await queryRunner.query(`
|
|
ALTER TABLE freight.vehicles
|
|
ADD COLUMN IF NOT EXISTS code varchar,
|
|
ADD COLUMN IF NOT EXISTS power_plate_no varchar,
|
|
ADD COLUMN IF NOT EXISTS trailer_plate_no varchar
|
|
`);
|
|
}
|
|
|
|
public async down(queryRunner: QueryRunner): Promise<void> {
|
|
await queryRunner.query(`
|
|
ALTER TABLE freight.vehicles
|
|
DROP COLUMN IF EXISTS code,
|
|
DROP COLUMN IF EXISTS power_plate_no,
|
|
DROP COLUMN IF EXISTS trailer_plate_no
|
|
`);
|
|
}
|
|
}
|