This commit is contained in:
natib21
2026-07-02 12:43:03 +00:00
parent 657f3bd2ab
commit 58b3805d0b
6 changed files with 36 additions and 7 deletions

View File

@@ -0,0 +1,22 @@
import { MigrationInterface, QueryRunner } from "typeorm";
/**
* Add FREE and BUSY statuses to vehicle status enum.
*/
export class AddVehicleStatuses1880000000000 implements MigrationInterface {
name = "AddVehicleStatuses1880000000000";
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`
ALTER TYPE freight.vehicles_status_enum ADD VALUE IF NOT EXISTS 'FREE' BEFORE 'MAINTENANCE';
`);
await queryRunner.query(`
ALTER TYPE freight.vehicles_status_enum ADD VALUE IF NOT EXISTS 'BUSY' AFTER 'FREE';
`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
// Note: Postgres cannot drop individual enum values, so the down migration is a no-op
// The enum values FREE and BUSY will remain but will be unused after downgrade
}
}