| 1 | -- Issues became work items (g1t #57): a webhook that asked for issue.* |
| 2 | -- events asks for the work_item.* events that replaced them, in the same |
| 3 | -- place in its list. Deliveries already made stay as they were sent; they |
| 4 | -- are forgotten after a fortnight. |
| 5 | UPDATE hooks |
| 6 | SET events = ( |
| 7 | SELECT json_group_array(CASE WHEN value LIKE 'issue.%' THEN 'work_item.' || substr(value, 7) ELSE value END) |
| 8 | FROM json_each(hooks.events) |
| 9 | ) |
| 10 | WHERE EXISTS (SELECT 1 FROM json_each(hooks.events) WHERE value LIKE 'issue.%'); |