8144-devToTest_2448 #3216
|
@ -3,7 +3,7 @@ ALTER TABLE vn.address
|
|||
ADD CONSTRAINT address_zoneGeo_FK FOREIGN KEY (geoFk)
|
||||
REFERENCES vn.zoneGeo(id) ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
|
||||
CREATE OR REPLACE TEMPORARY TABLE tAddressGeo
|
||||
CREATE OR REPLACE TEMPORARY TABLE tmp.tAddressGeo
|
||||
(PRIMARY KEY (id))
|
||||
ENGINE = MEMORY
|
||||
SELECT a.id, p.geoFk
|
||||
|
@ -15,7 +15,7 @@ CREATE OR REPLACE TEMPORARY TABLE tAddressGeo
|
|||
(p.code = a.postalCode) DESC;
|
||||
|
||||
UPDATE address a
|
||||
JOIN tAddressGeo tag ON tag.id = a.id
|
||||
JOIN tmp.tAddressGeo tag ON tag.id = a.id
|
||||
SET a.geoFk = tag.geoFk;
|
||||
|
||||
DROP TEMPORARY TABLE tAddressGeo;
|
||||
DROP TEMPORARY TABLE tmp.tAddressGeo;
|
||||
|
|
|
@ -6,7 +6,7 @@ ALTER TABLE vn.client
|
|||
ADD CONSTRAINT client_zoneGeo_FK FOREIGN KEY (geoFk)
|
||||
REFERENCES vn.zoneGeo(id) ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
|
||||
CREATE OR REPLACE TEMPORARY TABLE tClientGeo
|
||||
CREATE OR REPLACE TEMPORARY TABLE tmp.tClientGeo
|
||||
(PRIMARY KEY (id))
|
||||
ENGINE = MEMORY
|
||||
SELECT c.id, p.geoFk
|
||||
|
@ -18,7 +18,7 @@ CREATE OR REPLACE TEMPORARY TABLE tClientGeo
|
|||
(p.code = c.postcode) DESC;
|
||||
|
||||
UPDATE client c
|
||||
JOIN tClientGeo tcg ON tcg.id = c.id
|
||||
JOIN tmp.tClientGeo tcg ON tcg.id = c.id
|
||||
SET c.geoFk = tcg.geoFk;
|
||||
|
||||
DROP TEMPORARY TABLE tClientGeo;
|
||||
DROP TEMPORARY TABLE tmp.tClientGeo;
|
||||
|
|
|
@ -5,7 +5,7 @@ ALTER TABLE vn.supplier
|
|||
ADD CONSTRAINT supplier_zoneGeo_FK FOREIGN KEY (geoFk)
|
||||
REFERENCES vn.zoneGeo(id) ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
|
||||
CREATE OR REPLACE TEMPORARY TABLE tSupplierGeo
|
||||
CREATE OR REPLACE TEMPORARY TABLE tmp.tSupplierGeo
|
||||
(PRIMARY KEY (id))
|
||||
ENGINE = MEMORY
|
||||
SELECT s.id, p.geoFk
|
||||
|
@ -19,7 +19,7 @@ CREATE OR REPLACE TEMPORARY TABLE tSupplierGeo
|
|||
(p.code = sad.postalCode) DESC;
|
||||
|
||||
UPDATE supplier s
|
||||
JOIN tSupplierGeo tsg ON tsg.id = s.id
|
||||
JOIN tmp.tSupplierGeo tsg ON tsg.id = s.id
|
||||
SET s.geoFk = tsg.geoFk;
|
||||
|
||||
DROP TEMPORARY TABLE tSupplierGeo;
|
||||
DROP TEMPORARY TABLE tmp.tSupplierGeo;
|
||||
|
|
Loading…
Reference in New Issue