From d9a12fd20379b13dcbd31069a97d3c2781c1e033 Mon Sep 17 00:00:00 2001 From: vicent Date: Thu, 7 Jul 2022 07:39:46 +0200 Subject: [PATCH] feat: update commissionWorkCenterFk where is not calculated --- db/changes/10480-june/00-route.sql | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 db/changes/10480-june/00-route.sql diff --git a/db/changes/10480-june/00-route.sql b/db/changes/10480-june/00-route.sql new file mode 100644 index 000000000..beb7d5e41 --- /dev/null +++ b/db/changes/10480-june/00-route.sql @@ -0,0 +1,10 @@ +UPDATE `vn`.`route` r + JOIN(SELECT r.id, wl.workcenterFk + FROM `vn`.`route` r + JOIN `vn`.`routeLog` rl ON rl.originFk = r.id + JOIN `vn`.`workerLabour` wl ON wl.workerFk = rl.userFk + AND r.created BETWEEN wl.started AND IFNULL(wl.ended, r.created) + WHERE r.created BETWEEN '2021-12-01' AND CURDATE() + AND rl.action = 'insert' + )sub ON sub.id = r.id + SET r.commissionWorkCenterFk = sub.workcenterFk; \ No newline at end of file