Cannot Delete Deployment in REST API

I am going through flowable docs and testing REST API. Then when I tried to delete the deployment using
curl -X DELETE --user rest-admin:test http://localhost:8080/flowable-rest/service/repository/deployments/617f5c54-462d-11e9-97b9-68a86d35f4ac

it gives ERROR as

{“message”:“Internal server error”,“exception”:"\n### Error updating database. Cause: org.h2.jdbc.JdbcSQLException: Referential integrity constraint violation: “ACT_FK_EXE_PROCDEF: PUBLIC.ACT_RU_EXECUTION FOREIGN KEY(PROC_DEF_ID_) REFERENCES PUBLIC.ACT_RE_PROCDEF(ID_) (‘holidayRequest:2:61ae5b96-462d-11e9-97b9-68a86d35f4ac’)”; SQL statement:\ndelete from ACT_RE_PROCDEF where DEPLOYMENT_ID_ = ? [23503-197]\n### The error may involve org.flowable.engine.impl.persistence.entity.ProcessDefinitionEntityImpl.deleteProcessDefinitionsByDeploymentId-Inline\n### The error occurred while setting parameters\n### SQL: delete from ACT_RE_PROCDEF where DEPLOYMENT_ID_ = ?\n### Cause: org.h2.jdbc.JdbcSQLException: Referential integrity constraint violation: “ACT_FK_EXE_PROCDEF: PUBLIC.ACT_RU_EXECUTION FOREIGN KEY(PROC_DEF_ID_) REFERENCES PUBLIC.ACT_RE_PROCDEF(ID_) (‘holidayRequest:2:61ae5b96-462d-11e9-97b9-68a86d35f4ac’)”; SQL statement:\ndelete from ACT_RE_PROCDEF where DEPLOYMENT_ID_ = ? [23503-197]"}

However when i use get deployment command it works.

Note: I have not changed anything. Everything is as per the docs and example process model

It seems that there is still process instance which points to this definition.

Martin

You are need to pass the cascade = true to delete all the foreign key references