Is there a way that can make sure the camunda will create the tables automatically for each engine


#1

In my case I have two process engine.
The datasource of the engins are connected same database diffrent schema.
When I start my application the camunda created the tables automatically for the first engine. And then I got a exception when the camunda try to build the second engine.
The exception is from camunda that say some table of camunda not exists.

So my question is how can I make sure the camunda will create the tables automatically for each engine ?

Thanks you all.


#2

Maybe I can call the method to request camunda to create the tables ? Is there have a interface can do that ?


#3

I read the SchemaOperationsProcessEngineBuild class source code and finded something wrong.
This class will check the table is or not exists in the schema.

In my test case there has two schema.
The first called tenant1
The second called tenant2

The tables are already exists in the tenant1 schema but not exists in the tenant2.
When the SchemaOperationsProcessEngineBuild check the tables is or not exists in tenant2 schema the result is always true.

The sql of qury the table is

SELECT TABLE_SCHEMA AS TABLE_CAT, NULL AS TABLE_SCHEM, TABLE_NAME, CASE WHEN TABLE_TYPE=‘BASE TABLE’ THEN CASE WHEN TABLE_SCHEMA = ‘mysql’ OR TABLE_SCHEMA = ‘performance_schema’ THEN ‘SYSTEM TABLE’ ELSE ‘TABLE’ END WHEN TABLE_TYPE=‘TEMPORARY’ THEN ‘LOCAL_TEMPORARY’ ELSE TABLE_TYPE END AS TABLE_TYPE, TABLE_COMMENT AS REMARKS, NULL AS TYPE_CAT, NULL AS TYPE_SCHEM, NULL AS TYPE_NAME, NULL AS SELF_REFERENCING_COL_NAME, NULL AS REF_GENERATION FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME LIKE ‘ACT_HI_PROCINST’ HAVING TABLE_TYPE IN (‘TABLE’,null,null,null,null) ORDER BY TABLE_TYPE, TABLE_SCHEMA, TABLE_NAME

If the tables existgs in any schema this sql will alwasy return a record and then the camunda will think the table is already exists will not create it.

This is a bug ?


#4

We experienced the same behavior with the SpringBoot Implementation.
The check for table existens is not correct implemented imho. It checks without considering the selected schema. So any schema with camunda tables visible to the DB user will result in a positive check and the application will fail, because there are actually no tables for the acutal schema of the application.

We solved this, by using diffrent DB users and userrights but it is still annoying on my local machine where I usually use root for my localhost DB.

It might be a MySQL specific problem though.