11 lines
247 B
MySQL
11 lines
247 B
MySQL
|
UPDATE vn.town t
|
||
|
LEFT JOIN vn.zoneGeo zg ON zg.id = t.geoFk
|
||
|
SET t.geoFk = NULL
|
||
|
WHERE zg.id IS NULL;
|
||
|
|
||
|
ALTER TABLE vn.town
|
||
|
ADD CONSTRAINT town_zoneGeo_FK FOREIGN KEY (geoFk)
|
||
|
REFERENCES vn.zoneGeo(id)
|
||
|
ON DELETE RESTRICT
|
||
|
ON UPDATE CASCADE;
|