How to remove a flow from the database

I deployed a flow and we used it for a while. Then we decided to abandon it. I removed the corresponding java code from my application, then Flowable started complaining about the deprecated model missing classes. What is the recommended way to remove a deprecated model from the Engine database?

Hi Christine.

When you remove only java code which is referenced from the running process instance process definition, the execution can’t continue and these kind of errors can occur.
The question is when process definition is deprecated. Only in the case when there is no process instance running according to process definition, process definition could be deleted.
In the case when there is a bug in the process definition, process instances can be migrated to the fixed process definition and continue in the execution.
Anyway I do not recommend to delete process definition. When process definition is deleted, process execution path can’t be reproduced from the history or log events.


I understand. I want to remove a flow altogether. I want to remove it from Flowable, then I can remove the supporting java code. How do I remove all versions of a flow from the runtime database?

I now removed the flow from the database, by removing the relevant row from the act_re_procdef table. Now the db seems to be corrupt.
I can drop the database and create a new one on my local computer or on a dev system, but I can’t really do that on a production server.

Hi Chrstine,

In general, I would not recommend to directly interact with the database whenever possible. Is there a business reason why you want to delete the definitions? If there isn’t, just leave it. Flowable has a strong focus on versioning and consistency so having all these definitions is actually helpful.

One way you could potentially achieve your goal is by deleting the deployment which contains the definition you want to get rid off.

You can do so by using the RepositoryService:
repositoryService.deleteDeployment(yourDeploymentId, true);

You can retrieve the the deploymentId of your process definition by calling processDefinition.getDeploymentId().

The second parameter indicates whether you also want to delete the instances and historic instances. Please be aware that deleting a deployment means that the other definitions of that deployment are deleted as well.

You can also have a look at the following method to get some insights what’s happening:


The reason I want to remove the flow is that I want to remove the related Java code.