-- ============================================================================
-- Copyright (C) 2026  ZUGFeRD Import Module
-- ============================================================================

ALTER TABLE llx_importzugferd_import ADD INDEX idx_importzugferd_import_ref (ref);
ALTER TABLE llx_importzugferd_import ADD INDEX idx_importzugferd_import_invoice (invoice_number);
ALTER TABLE llx_importzugferd_import ADD UNIQUE INDEX uk_importzugferd_import_hash (file_hash, entity);
ALTER TABLE llx_importzugferd_import ADD INDEX idx_importzugferd_import_fk_soc (fk_soc);
ALTER TABLE llx_importzugferd_import ADD INDEX idx_importzugferd_import_fk_facture (fk_facture_fourn);
ALTER TABLE llx_importzugferd_import ADD INDEX idx_importzugferd_import_status (status);
ALTER TABLE llx_importzugferd_import ADD INDEX idx_importzugferd_import_buyer_ref (buyer_reference);

ALTER TABLE llx_importzugferd_import ADD CONSTRAINT fk_importzugferd_import_fk_soc FOREIGN KEY (fk_soc) REFERENCES llx_societe(rowid);
ALTER TABLE llx_importzugferd_import ADD CONSTRAINT fk_importzugferd_import_fk_user_creat FOREIGN KEY (fk_user_creat) REFERENCES llx_user(rowid);
