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

ALTER TABLE llx_importzugferd_productmapping ADD INDEX idx_productmapping_fk_soc (fk_soc);
ALTER TABLE llx_importzugferd_productmapping ADD INDEX idx_productmapping_fk_product (fk_product);
ALTER TABLE llx_importzugferd_productmapping ADD INDEX idx_productmapping_supplier_ref (supplier_ref);
ALTER TABLE llx_importzugferd_productmapping ADD INDEX idx_productmapping_ean (ean);
ALTER TABLE llx_importzugferd_productmapping ADD UNIQUE INDEX uk_productmapping_soc_ref (fk_soc, supplier_ref, entity);

ALTER TABLE llx_importzugferd_productmapping ADD CONSTRAINT fk_productmapping_fk_soc FOREIGN KEY (fk_soc) REFERENCES llx_societe(rowid);
ALTER TABLE llx_importzugferd_productmapping ADD CONSTRAINT fk_productmapping_fk_product FOREIGN KEY (fk_product) REFERENCES llx_product(rowid);
ALTER TABLE llx_importzugferd_productmapping ADD CONSTRAINT fk_productmapping_fk_user_creat FOREIGN KEY (fk_user_creat) REFERENCES llx_user(rowid);
