1
When issuing a NF-e it is possible to insert up to 990 products/items per document . Each product has several attributes. What would be the best way to store and link each product, and its respective attributes, to an NF-e?
I currently have the following structure:
Table nfe
:
`id` int(11) NOT NULL AUTO_INCREMENT,
`id_nfe` int(11) DEFAULT NULL,
`id_emitente` varchar(255) DEFAULT NULL,
...
Table tributos_prod
:
`id` int(11) NOT NULL AUTO_INCREMENT,
`id_nfe` int(11) NOT NULL,
`codigo` varchar(255) DEFAULT NULL,
...,
KEY `fk_nfe` (`id_nfe`),
CONSTRAINT `fk_nfe` FOREIGN KEY (`id_nfe`) REFERENCES `nfe` (`id`)
Problem: as each product/item will have a unique ID, there would be "infinite" table growth tributos_prod
, making a maintainable control impossible, because the Authorize issuance of an NF-e I can remove all products linked to this, or even by simply removing a single item.