11 lines
305 B
MySQL
11 lines
305 B
MySQL
|
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;
|