salix/db/versions/.archive/10142-silverMedeola/00-firstScript.sql

11 lines
305 B
MySQL
Raw Permalink Normal View History

UPDATE hedera.orderRow or2
LEFT JOIN vn.sale s ON s.id = or2.saleFk
SET or2.saleFk = NULL
WHERE s.id IS NULL AND or2.saleFk IS NOT NULL;
ALTER TABLE `hedera`.`orderRow`
ADD CONSTRAINT `orderRow_ibfk_4`
FOREIGN KEY (`saleFk`)
REFERENCES `vn`.`sale` (`id`)
ON DELETE SET NULL
ON UPDATE CASCADE;