import { MigrationInterface, QueryRunner } from 'typeorm'; export class AddLocomotiveReadiness1781000000000 implements MigrationInterface { name = 'AddLocomotiveReadiness1781000000000'; public async up(queryRunner: QueryRunner): Promise { await queryRunner.query(` ALTER TABLE freight.locomotives ADD COLUMN IF NOT EXISTS readiness VARCHAR(20) NOT NULL DEFAULT 'IMPORT_READY' `); await queryRunner.query(` CREATE INDEX IF NOT EXISTS idx_locomotives_readiness ON freight.locomotives (readiness) WHERE deleted_at IS NULL `); } public async down(queryRunner: QueryRunner): Promise { await queryRunner.query(`DROP INDEX IF EXISTS freight.idx_locomotives_readiness`); await queryRunner.query(` ALTER TABLE freight.locomotives DROP COLUMN IF EXISTS readiness `); } }