Usage of databaseTablePrefix property and database creation scripts

Hello.

We are unable to use default database prefixes for bproc add-on. I have found that the flowable has property ‘databaseTablePrefix’ for a processEngine. I have checked it and it works fine.
But there are default create scripts for bproc add-on and the scripts have different table names (I mean without this databaseTablePrefix). So the question is how can I correct/replace the default scripts?

Hi,

you may try excluding database scripts by modifying the assbleDbScripts gradle task in the build.gradle, e.g. for postgres database flowable init scripts may be removed in the following way:

configure(coreModule) {
 ...
    assembleDbScripts.doLast {
        project.delete("${project.buildDir}/db/50-bproc/init/postgres/flowable.postgres.all.create-db.sql")
    }
}

To set the database table prefix you may use a BeforeProcessEngineInitEvent event handler:

@Component("sample_MyEngineInitializer")
public class MyEngineInitializer {

    @EventListener
    public void onBeforeProcessEngineInit(BeforeProcessEngineInitEvent event) {
        ProcessEngineConfiguration processEngineConfiguration = event.getProcessEngineConfiguration();
        processEngineConfiguration.setDatabaseTablePrefix("aaa_");
    }
}

Hi Max.

Thank you. It works great. But I have slightly change the solution. I have modified gradle task as you said. Process engine configuration has been changed in another way. I have change the whole schema not only prefix.

@EventListener
public fun onBeforeProcessEngineInit(event: BeforeProcessEngineInitEvent) {
    val configuration = event.processEngineConfiguration
    configuration.databaseSchema="flowable_schema"
    configuration.databaseSchemaUpdate="true"
}