feat(warehouses): record container vs bulk freight type

Nullable freight_type on the warehouse, null meaning it takes both.
No backfill: every existing warehouse is unrestricted today and
writing a value would narrow allocation behind the operator's back.
Reuses FREIGHT_TYPES from the booking entity rather than a third copy
of the same two values.
This commit is contained in:
Hagernesh
2026-08-28 15:04:39 +00:00
parent d4373dfbe4
commit ba79b36d90
7 changed files with 81 additions and 3 deletions

View File

@@ -0,0 +1,21 @@
import { MigrationInterface, QueryRunner } from 'typeorm';
/**
* `freight.warehouses.freight_type` — CONTAINER or BULK, or null for a site
* that takes both.
*
* Nullable with no backfill on purpose: every existing warehouse predates the
* field and is unrestricted today, so writing a value would narrow live
* allocation behind the operator's back.
*/
export class WarehouseFreightType3820000000000 implements MigrationInterface {
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE freight.warehouses ADD COLUMN IF NOT EXISTS freight_type varchar(16)`,
);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE freight.warehouses DROP COLUMN IF EXISTS freight_type`);
}
}