-- La misma factura no puede volver a guardarse, incluso si llega por otro flujo.
-- NULL permite documentos donde OCR no logró identificar RNC y NCF.
ALTER TABLE `Document`
  ADD COLUMN `contentHash` CHAR(64) NULL,
  ADD COLUMN `invoiceFingerprint` VARCHAR(191) NULL;

CREATE UNIQUE INDEX `Document_contentHash_key` ON `Document`(`contentHash`);
CREATE UNIQUE INDEX `Document_invoiceFingerprint_key` ON `Document`(`invoiceFingerprint`);
