diff --git a/db/versions/11346-yellowPhormium/00-address.sql b/db/versions/11346-yellowPhormium/00-address.sql index 70683fc8f..2f8033b0a 100644 --- a/db/versions/11346-yellowPhormium/00-address.sql +++ b/db/versions/11346-yellowPhormium/00-address.sql @@ -7,14 +7,14 @@ CREATE OR REPLACE TEMPORARY TABLE tmp.tAddressGeo (PRIMARY KEY (id)) ENGINE = MEMORY SELECT a.id, p.geoFk - FROM address a - JOIN town t ON t.provinceFk = a.provinceFk - JOIN postCode p ON p.townFk = t.id + FROM vn.address a + JOIN vn.town t ON t.provinceFk = a.provinceFk + JOIN vn.postCode p ON p.townFk = t.id GROUP BY a.id ORDER BY (a.city SOUNDS LIKE t.`name`) DESC, (p.code = a.postalCode) DESC; -UPDATE address a +UPDATE vn.address a JOIN tmp.tAddressGeo tag ON tag.id = a.id SET a.geoFk = tag.geoFk; diff --git a/db/versions/11346-yellowPhormium/01-client.sql b/db/versions/11346-yellowPhormium/01-client.sql index a8bd16921..855d873f9 100644 --- a/db/versions/11346-yellowPhormium/01-client.sql +++ b/db/versions/11346-yellowPhormium/01-client.sql @@ -10,14 +10,14 @@ CREATE OR REPLACE TEMPORARY TABLE tmp.tClientGeo (PRIMARY KEY (id)) ENGINE = MEMORY SELECT c.id, p.geoFk - FROM client c - JOIN town t ON t.provinceFk = c.provinceFk - JOIN postCode p ON p.townFk = t.id + FROM vn.client c + JOIN vn.town t ON t.provinceFk = c.provinceFk + JOIN vn.postCode p ON p.townFk = t.id GROUP BY c.id ORDER BY (c.city SOUNDS LIKE t.`name`) DESC, (p.code = c.postcode) DESC; -UPDATE client c +UPDATE vn.client c JOIN tmp.tClientGeo tcg ON tcg.id = c.id SET c.geoFk = tcg.geoFk; diff --git a/db/versions/11346-yellowPhormium/02-supplier.sql b/db/versions/11346-yellowPhormium/02-supplier.sql index 5f902d039..9a0cd5b42 100644 --- a/db/versions/11346-yellowPhormium/02-supplier.sql +++ b/db/versions/11346-yellowPhormium/02-supplier.sql @@ -9,16 +9,16 @@ CREATE OR REPLACE TEMPORARY TABLE tmp.tSupplierGeo (PRIMARY KEY (id)) ENGINE = MEMORY SELECT s.id, p.geoFk - FROM supplier s - JOIN town t ON t.provinceFk = s.provinceFk - JOIN postCode p ON p.townFk = t.id - LEFT JOIN supplierAddress sad ON sad.supplierFk = s.id + FROM vn.supplier s + JOIN vn.town t ON t.provinceFk = s.provinceFk + JOIN vn.postCode p ON p.townFk = t.id + LEFT JOIN vn.supplierAddress sad ON sad.supplierFk = s.id GROUP BY s.id ORDER BY (s.city SOUNDS LIKE t.`name`) DESC, (p.code = s.postCode) DESC, (p.code = sad.postalCode) DESC; -UPDATE supplier s +UPDATE vn.supplier s JOIN tmp.tSupplierGeo tsg ON tsg.id = s.id SET s.geoFk = tsg.geoFk;