Skip to content

Commit

Permalink
Add cmmn + eventregistry SQL drop scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
jbarrez committed Jul 15, 2024
1 parent fe2b084 commit d3ad2b9
Show file tree
Hide file tree
Showing 11 changed files with 278 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
alter table ACT_CMMN_RU_MIL_INST drop foreign key ACT_FK_MIL_CASE_INST;
alter table ACT_CMMN_RU_MIL_INST drop foreign key ACT_FK_MIL_CASE_DEF;
alter table ACT_CMMN_RU_SENTRY_PART_INST drop foreign key ACT_FK_SENTRY_PLAN_ITEM;
alter table ACT_CMMN_RU_SENTRY_PART_INST drop foreign key ACT_FK_SENTRY_CASE_INST;
alter table ACT_CMMN_RU_SENTRY_PART_INST drop foreign key ACT_FK_SENTRY_CASE_DEF;
alter table ACT_CMMN_RU_PLAN_ITEM_INST drop foreign key ACT_FK_PLAN_ITEM_CASE_INST;
alter table ACT_CMMN_RU_PLAN_ITEM_INST drop foreign key ACT_FK_PLAN_ITEM_CASE_DEF;
alter table ACT_CMMN_RU_CASE_INST drop foreign key ACT_FK_CASE_INST_CASE_DEF;
alter table ACT_CMMN_CASEDEF drop foreign key ACT_FK_CASE_DEF_DPLY;
alter table ACT_CMMN_DEPLOYMENT_RESOURCE drop foreign key ACT_FK_CMMN_RSRC_DPL;

drop index ACT_IDX_HI_PLAN_ITEM_INST_CASE;
drop index ACT_IDX_HI_PLAN_ITEM_INST_CASE;
drop index ACT_IDX_CASE_INST_REF_ID_;
drop index ACT_IDX_CASE_DEF_UNIQ;
drop index ACT_IDX_PLAN_ITEM_STAGE_INST;
drop index ACT_IDX_MIL_CASE_INST;
drop index ACT_IDX_MIL_CASE_DEF;
drop index ACT_IDX_SENTRY_PLAN_ITEM;
drop index ACT_IDX_SENTRY_CASE_INST;
drop index ACT_IDX_SENTRY_CASE_DEF;
drop index ACT_IDX_PLAN_ITEM_CASE_INST;
drop index ACT_IDX_PLAN_ITEM_CASE_DEF;
drop index ACT_IDX_CASE_INST_PARENT;
drop index ACT_IDX_CASE_INST_CASE_DEF;
drop index ACT_IDX_CASE_DEF_DPLY;
drop index ACT_IDX_CMMN_RSRC_DPL;

drop table ACT_CMMN_HI_PLAN_ITEM_INST;
drop table ACT_CMMN_HI_MIL_INST;
drop table ACT_CMMN_HI_CASE_INST;
drop table ACT_CMMN_RU_MIL_INST;
drop table ACT_CMMN_RU_SENTRY_PART_INST;
drop table ACT_CMMN_RU_PLAN_ITEM_INST;
drop table ACT_CMMN_RU_CASE_INST;
drop table ACT_CMMN_CASEDEF;
drop table ACT_CMMN_DEPLOYMENT_RESOURCE;
drop table ACT_CMMN_DEPLOYMENT;
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
drop table if exists ACT_CMMN_HI_PLAN_ITEM_INST cascade constraints;
drop table if exists ACT_CMMN_HI_MIL_INST cascade constraints;
drop table if exists ACT_CMMN_HI_CASE_INST cascade constraints;
drop table if exists ACT_CMMN_RU_MIL_INST cascade constraints;
drop table if exists ACT_CMMN_RU_SENTRY_PART_INST cascade constraints;
drop table if exists ACT_CMMN_RU_PLAN_ITEM_INST cascade constraints;
drop table if exists ACT_CMMN_RU_CASE_INST cascade constraints;
drop table if exists ACT_CMMN_CASEDEF cascade constraints;
drop table if exists ACT_CMMN_DEPLOYMENT_RESOURCE cascade constraints;
drop table if exists ACT_CMMN_DEPLOYMENT cascade constraints;

drop index if exists ACT_IDX_HI_PLAN_ITEM_INST_CASE;
drop index if exists ACT_IDX_HI_PLAN_ITEM_INST_CASE;
drop index if exists ACT_IDX_CASE_INST_REF_ID_;
drop index if exists ACT_IDX_CASE_DEF_UNIQ;
drop index if exists ACT_IDX_PLAN_ITEM_STAGE_INST;
drop index if exists ACT_IDX_MIL_CASE_INST;
drop index if exists ACT_IDX_MIL_CASE_DEF;
drop index if exists ACT_IDX_SENTRY_PLAN_ITEM;
drop index if exists ACT_IDX_SENTRY_CASE_INST;
drop index if exists ACT_IDX_SENTRY_CASE_DEF;
drop index if exists ACT_IDX_PLAN_ITEM_CASE_INST;
drop index if exists ACT_IDX_PLAN_ITEM_CASE_DEF;
drop index if exists ACT_IDX_CASE_INST_PARENT;
drop index if exists ACT_IDX_CASE_INST_CASE_DEF;
drop index if exists ACT_IDX_CASE_DEF_DPLY;
drop index if exists ACT_IDX_CMMN_RSRC_DPL;
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
drop table if exists ACT_CMMN_HI_PLAN_ITEM_INST cascade constraints;
drop table if exists ACT_CMMN_HI_MIL_INST cascade constraints;
drop table if exists ACT_CMMN_HI_CASE_INST cascade constraints;
drop table if exists ACT_CMMN_RU_MIL_INST cascade constraints;
drop table if exists ACT_CMMN_RU_SENTRY_PART_INST cascade constraints;
drop table if exists ACT_CMMN_RU_PLAN_ITEM_INST cascade constraints;
drop table if exists ACT_CMMN_RU_CASE_INST cascade constraints;
drop table if exists ACT_CMMN_CASEDEF cascade constraints;
drop table if exists ACT_CMMN_DEPLOYMENT_RESOURCE cascade constraints;
drop table if exists ACT_CMMN_DEPLOYMENT cascade constraints;

drop index if exists ACT_IDX_HI_PLAN_ITEM_INST_CASE;
drop index if exists ACT_IDX_HI_PLAN_ITEM_INST_CASE;
drop index if exists ACT_IDX_CASE_INST_REF_ID_;
drop index if exists ACT_IDX_CASE_DEF_UNIQ;
drop index if exists ACT_IDX_PLAN_ITEM_STAGE_INST;
drop index if exists ACT_IDX_MIL_CASE_INST;
drop index if exists ACT_IDX_MIL_CASE_DEF;
drop index if exists ACT_IDX_SENTRY_PLAN_ITEM;
drop index if exists ACT_IDX_SENTRY_CASE_INST;
drop index if exists ACT_IDX_SENTRY_CASE_DEF;
drop index if exists ACT_IDX_PLAN_ITEM_CASE_INST;
drop index if exists ACT_IDX_PLAN_ITEM_CASE_DEF;
drop index if exists ACT_IDX_CASE_INST_PARENT;
drop index if exists ACT_IDX_CASE_INST_CASE_DEF;
drop index if exists ACT_IDX_CASE_DEF_DPLY;
drop index if exists ACT_IDX_CMMN_RSRC_DPL;
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
IF EXISTS (SELECT name FROM sysindexes WHERE name = 'ACT_IDX_HI_PLAN_ITEM_INST_CASE') drop index ACT_CMMN_HI_PLAN_ITEM_INST.ACT_IDX_HI_PLAN_ITEM_INST_CASE;
IF EXISTS (SELECT name FROM sysindexes WHERE name = 'ACT_IDX_HI_PLAN_ITEM_INST_CASE') drop index ACT_CMMN_HI_PLAN_ITEM_INST.ACT_IDX_HI_PLAN_ITEM_INST_CASE;
IF EXISTS (SELECT name FROM sysindexes WHERE name = 'ACT_IDX_CASE_INST_REF_ID_') drop index ACT_CMMN_RU_CASE_INST.ACT_IDX_CASE_INST_REF_ID_;
IF EXISTS (SELECT name FROM sysindexes WHERE name = 'ACT_IDX_CASE_DEF_UNIQ') drop index ACT_CMMN_CASEDEF.ACT_IDX_CASE_DEF_UNIQ;
IF EXISTS (SELECT name FROM sysindexes WHERE name = 'ACT_IDX_PLAN_ITEM_STAGE_INST') drop index ACT_CMMN_RU_PLAN_ITEM_INST.ACT_IDX_PLAN_ITEM_STAGE_INST;
IF EXISTS (SELECT name FROM sysindexes WHERE name = 'ACT_IDX_MIL_CASE_INST') drop index ACT_CMMN_RU_MIL_INST.ACT_IDX_MIL_CASE_INST;
IF EXISTS (SELECT name FROM sysindexes WHERE name = 'ACT_IDX_MIL_CASE_DEF') drop index ACT_CMMN_RU_MIL_INST.ACT_IDX_MIL_CASE_DEF;
IF EXISTS (SELECT name FROM sysindexes WHERE name = 'ACT_IDX_SENTRY_PLAN_ITEM') drop index ACT_CMMN_RU_SENTRY_PART_INST.ACT_IDX_SENTRY_PLAN_ITEM;
IF EXISTS (SELECT name FROM sysindexes WHERE name = 'ACT_IDX_SENTRY_CASE_INST') drop index ACT_CMMN_RU_SENTRY_PART_INST.ACT_IDX_SENTRY_CASE_INST;
IF EXISTS (SELECT name FROM sysindexes WHERE name = 'ACT_IDX_SENTRY_CASE_DEF') drop index ACT_CMMN_RU_SENTRY_PART_INST.ACT_IDX_SENTRY_CASE_DEF;
IF EXISTS (SELECT name FROM sysindexes WHERE name = 'ACT_IDX_PLAN_ITEM_CASE_INST') drop index ACT_CMMN_RU_PLAN_ITEM_INST.ACT_IDX_PLAN_ITEM_CASE_INST;
IF EXISTS (SELECT name FROM sysindexes WHERE name = 'ACT_IDX_PLAN_ITEM_CASE_DEF') drop index ACT_CMMN_RU_PLAN_ITEM_INST.ACT_IDX_PLAN_ITEM_CASE_DEF;
IF EXISTS (SELECT name FROM sysindexes WHERE name = 'ACT_IDX_CASE_INST_PARENT') drop index ACT_CMMN_RU_CASE_INST.ACT_IDX_CASE_INST_PARENT;
IF EXISTS (SELECT name FROM sysindexes WHERE name = 'ACT_IDX_CASE_INST_CASE_DEF') drop index ACT_CMMN_RU_CASE_INST.ACT_IDX_CASE_INST_CASE_DEF;
IF EXISTS (SELECT name FROM sysindexes WHERE name = 'ACT_IDX_CASE_DEF_DPLY') drop index ACT_CMMN_CASEDEF.ACT_IDX_CASE_DEF_DPLY;
IF EXISTS (SELECT name FROM sysindexes WHERE name = 'ACT_IDX_CMMN_RSRC_DPL') drop index ACT_CMMN_DEPLOYMENT_RESOURCE.ACT_IDX_CMMN_RSRC_DPL;

if exists (select TABLE_NAME from INFORMATION_SCHEMA.TABLES where TABLE_NAME = 'ACT_CMMN_RU_MIL_INST') alter table ACT_CMMN_RU_MIL_INST drop constraint ACT_FK_MIL_CASE_INST;
if exists (select TABLE_NAME from INFORMATION_SCHEMA.TABLES where TABLE_NAME = 'ACT_CMMN_RU_MIL_INST') alter table ACT_CMMN_RU_MIL_INST drop constraint ACT_FK_MIL_CASE_DEF;
if exists (select TABLE_NAME from INFORMATION_SCHEMA.TABLES where TABLE_NAME = 'ACT_CMMN_RU_SENTRY_PART_INST') alter table ACT_CMMN_RU_SENTRY_PART_INST drop constraint ACT_FK_SENTRY_PLAN_ITEM;
if exists (select TABLE_NAME from INFORMATION_SCHEMA.TABLES where TABLE_NAME = 'ACT_CMMN_RU_SENTRY_PART_INST') alter table ACT_CMMN_RU_SENTRY_PART_INST drop constraint ACT_FK_SENTRY_CASE_INST;
if exists (select TABLE_NAME from INFORMATION_SCHEMA.TABLES where TABLE_NAME = 'ACT_CMMN_RU_SENTRY_PART_INST') alter table ACT_CMMN_RU_SENTRY_PART_INST drop constraint ACT_FK_SENTRY_CASE_DEF;
if exists (select TABLE_NAME from INFORMATION_SCHEMA.TABLES where TABLE_NAME = 'ACT_CMMN_RU_PLAN_ITEM_INST') alter table ACT_CMMN_RU_PLAN_ITEM_INST drop constraint ACT_FK_PLAN_ITEM_CASE_INST;
if exists (select TABLE_NAME from INFORMATION_SCHEMA.TABLES where TABLE_NAME = 'ACT_CMMN_RU_PLAN_ITEM_INST') alter table ACT_CMMN_RU_PLAN_ITEM_INST drop constraint ACT_FK_PLAN_ITEM_CASE_DEF;
if exists (select TABLE_NAME from INFORMATION_SCHEMA.TABLES where TABLE_NAME = 'ACT_CMMN_RU_CASE_INST') alter table ACT_CMMN_RU_CASE_INST drop constraint ACT_FK_CASE_INST_CASE_DEF;
if exists (select TABLE_NAME from INFORMATION_SCHEMA.TABLES where TABLE_NAME = 'ACT_CMMN_CASEDEF') alter table ACT_CMMN_CASEDEF drop constraint ACT_FK_CASE_DEF_DPLY;
if exists (select TABLE_NAME from INFORMATION_SCHEMA.TABLES where TABLE_NAME = 'ACT_CMMN_DEPLOYMENT_RESOURCE') alter table ACT_CMMN_DEPLOYMENT_RESOURCE drop constraint ACT_FK_CMMN_RSRC_DPL;

if exists (select TABLE_NAME from INFORMATION_SCHEMA.TABLES where TABLE_NAME = 'ACT_CMMN_HI_PLAN_ITEM_INST') drop table ACT_CMMN_HI_PLAN_ITEM_INST;
if exists (select TABLE_NAME from INFORMATION_SCHEMA.TABLES where TABLE_NAME = 'ACT_CMMN_HI_MIL_INST') drop table ACT_CMMN_HI_MIL_INST;
if exists (select TABLE_NAME from INFORMATION_SCHEMA.TABLES where TABLE_NAME = 'ACT_CMMN_HI_CASE_INST') drop table ACT_CMMN_HI_CASE_INST;
if exists (select TABLE_NAME from INFORMATION_SCHEMA.TABLES where TABLE_NAME = 'ACT_CMMN_RU_MIL_INST') drop table ACT_CMMN_RU_MIL_INST;
if exists (select TABLE_NAME from INFORMATION_SCHEMA.TABLES where TABLE_NAME = 'ACT_CMMN_RU_SENTRY_PART_INST') drop table ACT_CMMN_RU_SENTRY_PART_INST;
if exists (select TABLE_NAME from INFORMATION_SCHEMA.TABLES where TABLE_NAME = 'ACT_CMMN_RU_PLAN_ITEM_INST') drop table ACT_CMMN_RU_PLAN_ITEM_INST;
if exists (select TABLE_NAME from INFORMATION_SCHEMA.TABLES where TABLE_NAME = 'ACT_CMMN_RU_CASE_INST') drop table ACT_CMMN_RU_CASE_INST;
if exists (select TABLE_NAME from INFORMATION_SCHEMA.TABLES where TABLE_NAME = 'ACT_CMMN_CASEDEF') drop table ACT_CMMN_CASEDEF;
if exists (select TABLE_NAME from INFORMATION_SCHEMA.TABLES where TABLE_NAME = 'ACT_CMMN_DEPLOYMENT_RESOURCE') drop table ACT_CMMN_DEPLOYMENT_RESOURCE;
if exists (select TABLE_NAME from INFORMATION_SCHEMA.TABLES where TABLE_NAME = 'ACT_CMMN_DEPLOYMENT') drop table ACT_CMMN_DEPLOYMENT;
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
alter table ACT_CMMN_RU_MIL_INST drop foreign key ACT_FK_MIL_CASE_INST;
alter table ACT_CMMN_RU_MIL_INST drop foreign key ACT_FK_MIL_CASE_DEF;
alter table ACT_CMMN_RU_SENTRY_PART_INST drop foreign key ACT_FK_SENTRY_PLAN_ITEM;
alter table ACT_CMMN_RU_SENTRY_PART_INST drop foreign key ACT_FK_SENTRY_CASE_INST;
alter table ACT_CMMN_RU_SENTRY_PART_INST drop foreign key ACT_FK_SENTRY_CASE_DEF;
alter table ACT_CMMN_RU_PLAN_ITEM_INST drop foreign key ACT_FK_PLAN_ITEM_CASE_INST;
alter table ACT_CMMN_RU_PLAN_ITEM_INST drop foreign key ACT_FK_PLAN_ITEM_CASE_DEF;
alter table ACT_CMMN_RU_CASE_INST drop foreign key ACT_FK_CASE_INST_CASE_DEF;
alter table ACT_CMMN_CASEDEF drop foreign key ACT_FK_CASE_DEF_DPLY;
alter table ACT_CMMN_DEPLOYMENT_RESOURCE drop foreign key ACT_FK_CMMN_RSRC_DPL;

drop index ACT_IDX_HI_PLAN_ITEM_INST_CASE on ACT_CMMN_HI_PLAN_ITEM_INST;
drop index ACT_IDX_HI_PLAN_ITEM_INST_CASE on ACT_CMMN_HI_PLAN_ITEM_INST;
drop index ACT_IDX_CASE_INST_REF_ID_ on ACT_CMMN_RU_CASE_INST;
drop index ACT_IDX_CASE_DEF_UNIQ on ACT_CMMN_CASEDEF;
drop index ACT_IDX_PLAN_ITEM_STAGE_INST on ACT_CMMN_RU_PLAN_ITEM_INST;
drop index ACT_IDX_MIL_CASE_INST on ACT_CMMN_RU_MIL_INST;
drop index ACT_IDX_MIL_CASE_DEF on ACT_CMMN_RU_MIL_INST;
drop index ACT_IDX_SENTRY_PLAN_ITEM on ACT_CMMN_RU_SENTRY_PART_INST;
drop index ACT_IDX_SENTRY_CASE_INST on ACT_CMMN_RU_SENTRY_PART_INST;
drop index ACT_IDX_SENTRY_CASE_DEF on ACT_CMMN_RU_SENTRY_PART_INST;
drop index ACT_IDX_PLAN_ITEM_CASE_INST on ACT_CMMN_RU_PLAN_ITEM_INST;
drop index ACT_IDX_PLAN_ITEM_CASE_DEF on ACT_CMMN_RU_PLAN_ITEM_INST;
drop index ACT_IDX_CASE_INST_PARENT on ACT_CMMN_RU_CASE_INST;
drop index ACT_IDX_CASE_INST_CASE_DEF on ACT_CMMN_RU_CASE_INST;
drop index ACT_IDX_CASE_DEF_DPLY on ACT_CMMN_CASEDEF;
drop index ACT_IDX_CMMN_RSRC_DPL on ACT_CMMN_DEPLOYMENT_RESOURCE;

drop table if exists ACT_CMMN_HI_PLAN_ITEM_INST;
drop table if exists ACT_CMMN_HI_MIL_INST;
drop table if exists ACT_CMMN_HI_CASE_INST;
drop table if exists ACT_CMMN_RU_MIL_INST;
drop table if exists ACT_CMMN_RU_SENTRY_PART_INST;
drop table if exists ACT_CMMN_RU_PLAN_ITEM_INST;
drop table if exists ACT_CMMN_RU_CASE_INST;
drop table if exists ACT_CMMN_CASEDEF;
drop table if exists ACT_CMMN_DEPLOYMENT_RESOURCE;
drop table if exists ACT_CMMN_DEPLOYMENT;
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
alter table ACT_CMMN_RU_MIL_INST drop constraint ACT_FK_MIL_CASE_INST;
alter table ACT_CMMN_RU_MIL_INST drop constraint ACT_FK_MIL_CASE_DEF;
alter table ACT_CMMN_RU_SENTRY_PART_INST drop constraint ACT_FK_SENTRY_PLAN_ITEM;
alter table ACT_CMMN_RU_SENTRY_PART_INST drop constraint ACT_FK_SENTRY_CASE_INST;
alter table ACT_CMMN_RU_SENTRY_PART_INST drop constraint ACT_FK_SENTRY_CASE_DEF;
alter table ACT_CMMN_RU_PLAN_ITEM_INST drop constraint ACT_FK_PLAN_ITEM_CASE_INST;
alter table ACT_CMMN_RU_PLAN_ITEM_INST drop constraint ACT_FK_PLAN_ITEM_CASE_DEF;
alter table ACT_CMMN_RU_CASE_INST drop constraint ACT_FK_CASE_INST_CASE_DEF;
alter table ACT_CMMN_CASEDEF drop constraint ACT_FK_CASE_DEF_DPLY;
alter table ACT_CMMN_DEPLOYMENT_RESOURCE drop constraint ACT_FK_CMMN_RSRC_DPL;

drop index ACT_IDX_HI_PLAN_ITEM_INST_CASE;
drop index ACT_IDX_HI_PLAN_ITEM_INST_CASE;
drop index ACT_IDX_CASE_INST_REF_ID_;
drop index ACT_IDX_CASE_DEF_UNIQ;
drop index ACT_IDX_PLAN_ITEM_STAGE_INST;
drop index ACT_IDX_MIL_CASE_INST;
drop index ACT_IDX_MIL_CASE_DEF;
drop index ACT_IDX_SENTRY_PLAN_ITEM;
drop index ACT_IDX_SENTRY_CASE_INST;
drop index ACT_IDX_SENTRY_CASE_DEF;
drop index ACT_IDX_PLAN_ITEM_CASE_INST;
drop index ACT_IDX_PLAN_ITEM_CASE_DEF;
drop index ACT_IDX_CASE_INST_PARENT;
drop index ACT_IDX_CASE_INST_CASE_DEF;
drop index ACT_IDX_CASE_DEF_DPLY;
drop index ACT_IDX_CMMN_RSRC_DPL;

drop table ACT_CMMN_HI_PLAN_ITEM_INST;
drop table ACT_CMMN_HI_MIL_INST;
drop table ACT_CMMN_HI_CASE_INST;
drop table ACT_CMMN_RU_MIL_INST;
drop table ACT_CMMN_RU_SENTRY_PART_INST;
drop table ACT_CMMN_RU_PLAN_ITEM_INST;
drop table ACT_CMMN_RU_CASE_INST;
drop table ACT_CMMN_CASEDEF;
drop table ACT_CMMN_DEPLOYMENT_RESOURCE;
drop table ACT_CMMN_DEPLOYMENT;
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
drop table ACT_CMMN_HI_PLAN_ITEM_INST cascade;
drop table ACT_CMMN_HI_MIL_INST cascade;
drop table ACT_CMMN_HI_CASE_INST cascade;
drop table ACT_CMMN_RU_MIL_INST cascade;
drop table ACT_CMMN_RU_SENTRY_PART_INST cascade;
drop table ACT_CMMN_RU_PLAN_ITEM_INST cascade;
drop table ACT_CMMN_RU_CASE_INST cascade;
drop table ACT_CMMN_CASEDEF cascade;
drop table ACT_CMMN_DEPLOYMENT_RESOURCE cascade;
drop table ACT_CMMN_DEPLOYMENT cascade;
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.flowable.cmmn.test.db;

import static org.assertj.core.api.Assertions.assertThat;

import org.flowable.cmmn.engine.test.FlowableCmmnTestCase;
import org.flowable.common.engine.impl.db.SchemaManager;
import org.flowable.common.engine.impl.db.SchemaOperationsEngineBuild;
import org.flowable.common.engine.impl.db.SchemaOperationsEngineDropDbCmd;
import org.junit.Test;

/**
* @author Joram Barrez
*/
public class CmmnEngineDropScriptsTest extends FlowableCmmnTestCase {

@Test
public void testDropSchema() {

// Dropping and recreating the schema should not have an impact on other tests
SchemaManager schemaManager = cmmnEngineConfiguration.getSchemaManager();
cmmnEngineConfiguration.getCommandExecutor().execute(new SchemaOperationsEngineDropDbCmd(cmmnEngineConfiguration.getEngineScopeType()));
assertThat(cmmnEngineConfiguration.getCmmnManagementService().getTableCounts().
keySet().stream().filter(tableName -> tableName.toLowerCase().startsWith("act_cmmn"))).hasSize(0);

cmmnEngineConfiguration.getCommandExecutor().execute(new SchemaOperationsEngineBuild(cmmnEngineConfiguration.getEngineScopeType()));
assertThat(cmmnEngineConfiguration.getCmmnManagementService().getTableCounts().
keySet().stream().filter(tableName -> tableName.toLowerCase().startsWith("act_cmmn"))).hasSize(10);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
drop index ACT_IDX_CHANNEL_DEF_UNIQ;
drop index ACT_IDX_EVENT_DEF_UNIQ;

drop table FLW_CHANNEL_DEFINITION;
drop table FLW_EVENT_DEFINITION;
drop table FLW_EVENT_RESOURCE;
drop table FLW_EVENT_DEPLOYMENT;
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
IF EXISTS (SELECT name FROM sysindexes WHERE name = 'ACT_IDX_CHANNEL_DEF_UNIQ') drop index FLW_CHANNEL_DEFINITION.ACT_IDX_CHANNEL_DEF_UNIQ;
IF EXISTS (SELECT name FROM sysindexes WHERE name = 'ACT_IDX_EVENT_DEF_UNIQ') drop index FLW_EVENT_DEFINITION.ACT_IDX_EVENT_DEF_UNIQ;

if exists (select TABLE_NAME from INFORMATION_SCHEMA.TABLES where TABLE_NAME = 'FLW_CHANNEL_DEFINITION') drop table FLW_CHANNEL_DEFINITION;
if exists (select TABLE_NAME from INFORMATION_SCHEMA.TABLES where TABLE_NAME = 'FLW_EVENT_DEFINITION') drop table FLW_EVENT_DEFINITION;
if exists (select TABLE_NAME from INFORMATION_SCHEMA.TABLES where TABLE_NAME = 'FLW_EVENT_RESOURCE') drop table FLW_EVENT_RESOURCE;
if exists (select TABLE_NAME from INFORMATION_SCHEMA.TABLES where TABLE_NAME = 'FLW_EVENT_DEPLOYMENT') drop table FLW_EVENT_DEPLOYMENT;
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
drop index ACT_IDX_CHANNEL_DEF_UNIQ;
drop index ACT_IDX_EVENT_DEF_UNIQ;

drop table FLW_CHANNEL_DEFINITION;
drop table FLW_EVENT_DEFINITION;
drop table FLW_EVENT_RESOURCE;
drop table FLW_EVENT_DEPLOYMENT;

0 comments on commit d3ad2b9

Please sign in to comment.