Skip to content

Instantly share code, notes, and snippets.

@billerby
Last active February 15, 2023 15:25
Show Gist options
  • Save billerby/4550e346b3c37d5b5c2dcf794f8c2a96 to your computer and use it in GitHub Desktop.
Save billerby/4550e346b3c37d5b5c2dcf794f8c2a96 to your computer and use it in GitHub Desktop.
Delete deployments in flowable by sql
--First delete the form instances based on an app deployment before 2022-12-01
delete from act_fo_form_instance where form_definition_id_ in (select id_ from act_fo_form_definition where deployment_id_ in (select id_ from act_fo_form_deployment where parent_deployment_id_ in (select id_ from act_app_deployment where deploy_time_ < '2022-12-01 00:00:00')))
-- Then delete all form resources (same condition as above)
delete from act_fo_form_resource where deployment_id_ in (select id_ from act_fo_form_deployment where parent_deployment_id_ in (select id_ from act_app_deployment where deploy_time_ < '2022-12-01 00:00:00'))
-- Then all form definitions for the same condition as above
delete from act_fo_form_definition where deployment_id_ in (select id_ from act_fo_form_deployment where parent_deployment_id_ in (select id_ from act_app_deployment where deploy_time_ < '2022-12-01 00:00:00'))
-- Form deployments
delete from act_fo_form_deployment where parent_deployment_id_ in (select id_ from act_app_deployment where deploy_time_ < '2022-12-01 00:00:00')
-- Dmn - the executions should already be handled by the process removal tool
-- start with the deployment resources
delete from act_dmn_deployment_resource where deployment_id_ in (select id_ from act_dmn_deployment where parent_deployment_id_ in (select id_ from act_app_deployment where deploy_time_ < '2022-12-01 00:00:00'))
delete from act_dmn_decision where deployment_id_ in (select id_ from act_dmn_deployment where parent_deployment_id_ in (select id_ from act_app_deployment where deploy_time_ < '2022-12-01 00:00:00'))
delete from act_dmn_deployment where parent_deployment_id_ in (select id_ from act_app_deployment where deploy_time_ < '2022-12-01 00:00:00')
-- Skip the content engine, the process remover handles it plus there exists content like logotypes and templates
-- move on to the process definitions etc.
delete from act_ge_bytearray where deployment_id_ in (select id_ from act_re_deployment where parent_deployment_id_ in (select id_ from act_app_deployment where deploy_time_ < '2022-12-01 00:00:00'))
delete from act_re_procdef where deployment_id_ in (select id_ from act_re_deployment where parent_deployment_id_ in (select id_ from act_app_deployment where deploy_time_ < '2022-12-01 00:00:00'))
delete from act_re_deployment where parent_deployment_id_ in (select id_ from act_app_deployment where deploy_time_ < '2022-12-01 00:00:00')
-- Finally the apps...
delete from act_app_appdef where deployment_id_ in (select id_ from act_app_deployment where deploy_time_ < '2022-12-01 00:00:00')
delete from act_app_deployment where deploy_time_ < '2022-12-01 00:00:00'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment