https://prefect.io logo
m

Marwan Sarieddine

01/15/2021, 12:23 AM
Hi folks, I am running a graphql mutation to delete a flow but I can still see the flow on the UI even after refreshing - is this because there are older versions of the flow ? I see there is an option to delete all the versions of a flow from the UI, is there an equivalent approach using graphql to do so?
n

nicholas

01/15/2021, 12:26 AM
Hi @Marwan Sarieddine - there should be a
DELETE
button in the top right of the flow page that has a checkbox to delete all versions of the flow.
m

Marwan Sarieddine

01/15/2021, 12:27 AM
Hi @nicholas thank you for the quick response - that's correct, I am asking about how to delete the flow and all its versions using graphql and not the UI (sorry if that wasn't clear)
I tried this - and it don't see where to specify deleting all the versions ...
Copy code
mutation{
  deleteFlow(input:{flowId: "myflowid"}){
    success,
    error
  }
}
n

nicholas

01/15/2021, 12:28 AM
Oh sorry, I misunderstood. You'll need to query for all the versions of your flow and then loop through them to delete
m

Marwan Sarieddine

01/15/2021, 12:29 AM
I see
n

nicholas

01/15/2021, 12:29 AM
So something like this:
Copy code
query {
  flow(where: {flow_group_id: {_eq: "<<id>>" } }}) {
    id
  }
}
(using the flow group id is the best way to get all the versions for that flow)
m

Marwan Sarieddine

01/15/2021, 12:31 AM
gotcha - thanks will give it a try
n

nicholas

01/15/2021, 12:32 AM
👍 Lmk if you run into any issues.
m

Marwan Sarieddine

01/15/2021, 12:44 AM
just tried it out - it works - thanks again 🙂
n

nicholas

01/15/2021, 12:45 AM
Great! 😄