Changing Ownership Of A Batch Change Before User Deletion

As of Sourcegraph v5.x.x batch changes that are assigned to a soft-deleted user will no longer be accessible to any user in the UI. 

We aware of this user experience and will be taking steps in the future to address this particular use case. 

In order to avoid "losing" the batch change (the batch change is still accessible in the database) please follow the following steps in order to change ownership of the batch change to a new user: 

  1. Head to the Site Admin of your Sourcegraph instance.
  2. At the bottom of the left-hand sidebar select "API Console". 
  3. If you have already soft-deleted (you cannot recover the data of a hard deleted user, all associated data of that user has been removed from the database) the user go ahead and recover the user by performing the below action on the Site Admin > Users & Auth > Users pageCleanShot 2024-07-08 at 16.04.27@2x.png
  4. Use the following GraphQL Query to get the list of batch changes of the soon to be deleted user and choose the ID belonging to the batch change(s) you'd like to change ownership of.
    query {
    user(username: "alex.jean-baptiste") {
    id
    siteAdmin
    batchChanges {
    nodes {
    id
    name
    }
    }
    }
    }
  5. Use the ID(s) you found in the last step and use them in the following GraphQL Mutation. The mutation will return the id of your batch change along with the url that it should now discoverable at. Once you've verified that the batch change is under new ownership and that any accompanying PRs haven't been disturbed feel free to delete the original user.
    mutation MoveBatchChange($batchChange: ID!, $newName: String, $newNamespace: ID) {
    moveBatchChange(batchChange: $batchChange, newName: $newName, newNamespace: $newNamespace) {
    id
    url
    }
    }
Was this article helpful?
0 out of 0 found this helpful

Articles in this section