import { MigrationInterface, QueryRunner } from "typeorm"; /** * Debit/credit note filing — confirmed directly by MoR support: same `/v1/register` endpoint, * distinguished by `DocumentDetails.Type` ("DEB"/"CRE") + a `Reason`, linked to the original * invoice via `ReferenceDetails.RelatedDocument`. See `Invoice.eimsDocumentType`. */ export class EimsDebitCreditNotes3550000000000 implements MigrationInterface { name = "EimsDebitCreditNotes3550000000000"; public async up(queryRunner: QueryRunner): Promise { await queryRunner.query(` ALTER TABLE freight.invoices ADD COLUMN IF NOT EXISTS eims_document_type varchar(8) NOT NULL DEFAULT 'INV', ADD COLUMN IF NOT EXISTS eims_reason text, ADD COLUMN IF NOT EXISTS related_invoice_id uuid REFERENCES freight.invoices(id) `); } public async down(queryRunner: QueryRunner): Promise { await queryRunner.query(` ALTER TABLE freight.invoices DROP COLUMN IF EXISTS eims_document_type, DROP COLUMN IF EXISTS eims_reason, DROP COLUMN IF EXISTS related_invoice_id `); } }