| 1 | -- Work items: runs that issues and their comments started name the events |
| 2 | -- that start them now, `work_item` and `work_item_comment`, and their |
| 3 | -- payload (`info.event`) has the item in `work_item`, where `issue` was. |
| 4 | -- A workflow's listed events stay as its file names them: a file that |
| 5 | -- still says `issues` starts nothing until it says `work_item`. |
| 6 | UPDATE runs |
| 7 | SET info = json_remove(json_set(info, '$.event.work_item', json(json_extract(info, '$.event.issue'))), '$.event.issue') |
| 8 | WHERE event IN ('issues', 'issue_comment') AND json_type(info, '$.event.issue') IS NOT NULL; |
| 9 | |
| 10 | UPDATE runs |
| 11 | SET event = CASE event WHEN 'issues' THEN 'work_item' ELSE 'work_item_comment' END, |
| 12 | info = json_set(info, '$.eventName', CASE event WHEN 'issues' THEN 'work_item' ELSE 'work_item_comment' END) |
| 13 | WHERE event IN ('issues', 'issue_comment'); |