import { MigrationInterface, QueryRunner } from 'typeorm'; /** * Allow DOMESTIC trade direction on weight_limit_rules (domestic corridor bookings). */ export class AddDomesticWeightLimitTradeDirection1781000000004 implements MigrationInterface { name = 'AddDomesticWeightLimitTradeDirection1781000000004'; public async up(queryRunner: QueryRunner): Promise { await queryRunner.query(` DO $$ BEGIN ALTER TYPE freight.weight_limit_rules_trade_direction_enum ADD VALUE 'DOMESTIC'; EXCEPTION WHEN duplicate_object THEN NULL; WHEN undefined_object THEN BEGIN ALTER TYPE weight_limit_rules_trade_direction_enum ADD VALUE 'DOMESTIC'; EXCEPTION WHEN duplicate_object THEN NULL; END; END $$; `); } public async down(_queryRunner: QueryRunner): Promise { // PostgreSQL does not support removing enum values safely. } }