mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-29 15:18:11 +00:00
25 lines
1016 B
TypeScript
25 lines
1016 B
TypeScript
import { MigrationInterface, QueryRunner, TableColumn } from 'typeorm';
|
|
|
|
/**
|
|
* Fix for fresh deployments: AddWarehouseInspection1750000000003 runs before
|
|
* the warehouse_inventory table exists, so it cannot add inspection_status.
|
|
*/
|
|
export class AddWarehouseInventoryInspectionStatusFix1791000000005 implements MigrationInterface {
|
|
private readonly table = 'freight.warehouse_inventory';
|
|
|
|
public async up(queryRunner: QueryRunner): Promise<void> {
|
|
if ((await queryRunner.hasTable(this.table)) && !(await queryRunner.hasColumn(this.table, 'inspection_status'))) {
|
|
await queryRunner.addColumn(
|
|
this.table,
|
|
new TableColumn({ name: 'inspection_status', type: 'varchar', length: '20', isNullable: true }),
|
|
);
|
|
}
|
|
}
|
|
|
|
public async down(queryRunner: QueryRunner): Promise<void> {
|
|
if ((await queryRunner.hasTable(this.table)) && (await queryRunner.hasColumn(this.table, 'inspection_status'))) {
|
|
await queryRunner.dropColumn(this.table, 'inspection_status');
|
|
}
|
|
}
|
|
}
|