mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-29 17:38:12 +00:00
29 lines
1.1 KiB
TypeScript
29 lines
1.1 KiB
TypeScript
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<void> {
|
|
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<void> {
|
|
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
|
|
`);
|
|
}
|
|
}
|