| 1 | -- Issues became work items (g1t #57): the `issues` resource is now `work`, |
| 2 | -- so `issues:read` and `issues:write` are `work:read` and `work:write`. |
| 3 | -- Every stored scope list is rewritten, so tokens, OAuth grants and codes |
| 4 | -- not yet exchanged keep exactly the access they had. A fine-grained |
| 5 | -- token's old named permissions (retired in 0041, read by nothing) follow |
| 6 | -- for tidiness. |
| 7 | UPDATE access_tokens SET scopes = REPLACE(scopes, 'issues:', 'work:') WHERE scopes LIKE '%issues:%'; |
| 8 | UPDATE oauth_grants SET scopes = REPLACE(scopes, 'issues:', 'work:') WHERE scopes LIKE '%issues:%'; |
| 9 | UPDATE oauth_codes SET scopes = REPLACE(scopes, 'issues:', 'work:') WHERE scopes LIKE '%issues:%'; |
| 10 | UPDATE access_tokens SET permissions = REPLACE(permissions, '"issues":', '"work":') WHERE permissions LIKE '%"issues":%'; |
| 11 | -- A run's token lists the operations it may use by name: the work item |
| 12 | -- operations took the issue ones' places, and commenting on a work item |
| 13 | -- is its own operation beside commenting on a pull request. |
| 14 | UPDATE access_tokens SET agent_scope = |
| 15 | REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(agent_scope, |
| 16 | '"get_issue"', '"get_work_item"'), |
| 17 | '"list_issues"', '"list_work_items"'), |
| 18 | '"create_issue"', '"open_work_item"'), |
| 19 | '"update_issue"', '"update_work_item"'), |
| 20 | '"close_issue"', '"close_work_item"'), |
| 21 | '"reopen_issue"', '"reopen_work_item"'), |
| 22 | '"claim_issue"', '"claim_work_item"'), |
| 23 | '"hand_off_issue"', '"hand_off_work_item"'), |
| 24 | '"import_issue"', '"import_work_items"'), |
| 25 | '"list_issue_labels"', '"list_work_item_labels"'), |
| 26 | '"add_issue_labels"', '"add_work_item_labels"'), |
| 27 | '"set_issue_labels"', '"set_work_item_labels"'), |
| 28 | '"remove_issue_labels"', '"remove_work_item_labels"'), |
| 29 | '"add_comment"', '"add_comment","add_work_item_comment"') |
| 30 | WHERE agent_scope IS NOT NULL; |