2024-09-30 07:17:27 +00:00
|
|
|
ALTER TABLE vn.invoiceOut ADD COLUMN IF NOT EXISTS customsAgentFk INT(11) DEFAULT NULL AFTER siiTrascendencyInvoiceOutFk;
|
2024-10-23 06:10:00 +00:00
|
|
|
ALTER TABLE vn.invoiceOut ADD COLUMN IF NOT EXISTS incotermsFk varchar(3) DEFAULT NULL AFTER customsAgentFk;
|
2024-09-30 07:17:27 +00:00
|
|
|
|
|
|
|
ALTER TABLE vn.invoiceOut ADD CONSTRAINT invoiceOut_customsAgentFk FOREIGN KEY (customsAgentFk)
|
|
|
|
REFERENCES vn.customsAgent (id) ON DELETE RESTRICT ON UPDATE CASCADE;
|
|
|
|
|
2024-10-23 06:10:00 +00:00
|
|
|
ALTER TABLE vn.invoiceOut ADD CONSTRAINT invoiceOut_incotermsFk FOREIGN KEY (incotermsFk)
|
|
|
|
REFERENCES vn.incoterms (`code`) ON DELETE RESTRICT ON UPDATE CASCADE;
|
|
|
|
|
2024-09-30 07:21:05 +00:00
|
|
|
UPDATE vn.invoiceOut io
|
2024-10-23 06:10:00 +00:00
|
|
|
JOIN vn.client c ON c.id = io.clientFk
|
|
|
|
JOIN vn.ticket t ON t.clientFk = c.id
|
|
|
|
JOIN vn.address a ON a.id = t.addressFk
|
|
|
|
SET io.customsAgentFk = a.customsAgentFk,
|
|
|
|
io.incotermsFk = a.incotermsFk;
|