This commit is contained in:
parent
3cdb6c438b
commit
781a8a4d10
|
@ -0,0 +1,10 @@
|
||||||
|
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;
|
|
@ -0,0 +1,10 @@
|
||||||
|
UPDATE vn.postCode pc
|
||||||
|
LEFT JOIN vn.zoneGeo zg ON zg.id = pc.geoFk
|
||||||
|
SET pc.geoFk = NULL
|
||||||
|
WHERE zg.id IS NULL;
|
||||||
|
|
||||||
|
ALTER TABLE vn.postCode
|
||||||
|
ADD CONSTRAINT postCode_zoneGeo_FK FOREIGN KEY (geoFk)
|
||||||
|
REFERENCES vn.zoneGeo(id)
|
||||||
|
ON DELETE RESTRICT
|
||||||
|
ON UPDATE CASCADE;
|
|
@ -0,0 +1,10 @@
|
||||||
|
UPDATE vn.province p
|
||||||
|
LEFT JOIN vn.zoneGeo zg ON zg.id = p.geoFk
|
||||||
|
SET p.geoFk = NULL
|
||||||
|
WHERE zg.id IS NULL;
|
||||||
|
|
||||||
|
ALTER TABLE vn.province
|
||||||
|
ADD CONSTRAINT province_zoneGeo_FK FOREIGN KEY (geoFk)
|
||||||
|
REFERENCES vn.zoneGeo(id)
|
||||||
|
ON DELETE RESTRICT
|
||||||
|
ON UPDATE CASCADE;
|
Loading…
Reference in New Issue