ALTER TABLE `persons` ADD CONSTRAINT `persons_ibfk_1` FOREIGN KEY (`location_id`) REFERENCES `locations` (`id`) ON DELETE SET `location_id` = 1;
谢谢
使用 ON DELETE SET DEFAULT ON DELETE SET NULL .
ON DELETE SET DEFAULT
ON DELETE SET NULL