HOTFIX: Update production starred modules data
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Joan Sanchez 2021-06-02 13:45:18 +02:00
parent 9ae91e1470
commit e2ec78461a
1 changed files with 8 additions and 1 deletions

View File

@ -1,2 +1,9 @@
ALTER TABLE `vn`.`starredModule`
ADD `position` INT NOT NULL AFTER `moduleFk`;
ADD `position` INT NOT NULL AFTER `moduleFk`;
SET @count:=0;
UPDATE `vn`.`starredModule` sm
JOIN (
SELECT sm.id, IF(@workerFk = sm.workerFk, @count:=@count+1, @count:=1) AS position, @workerFk:=sm.workerFk
FROM `vn`.`starredModule` sm ORDER BY workerFk, moduleFk ASC) AS smt ON smt.id = sm.id
SET sm.position = smt.position;