salix/db/versions/.archive/10387-wheatRuscus/00-firstScript.sql

18 lines
616 B
SQL

USE vn;
ALTER TABLE `vn`.`routeAction`
ADD COLUMN `isMainlineDelivered` TINYINT NOT NULL DEFAULT 0 AFTER `price`;
ALTER TABLE `vn`.`routeConfig`
ADD COLUMN `truckerBusinessProfessionalCategoryFk` INT NOT NULL DEFAULT 42 AFTER `kmMax`;
UPDATE vn.routeCommission rc
JOIN (SELECT rc.routeFk, r.m3
FROM routeCommission rc
JOIN vn.route r ON r.id = rc.routeFk
WHERE (cat4m3 IS NULL OR cat5m3 IS NULL)
AND r.m3 IS NOT NULL)sub ON sub.routeFk = rc.routeFk
JOIN routeConfig rcon
SET rc.m3 = sub.m3,
rc.cat4m3 = sub.m3 * rcon.distributionCat4M3,
rc.cat5m3 = sub.m3 * rcon.distributionCat5M3;