Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

specify a database schema for activiti-5.12.1 tables

I am going to use activiti-5.12.1, in my project.

here is the activiti.cfg.xml file:

<?xml version='1.0' encoding='UTF-8'?>

<beans xmlns="http://www.springframework.org/schema/beans" 
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://www.springframework.org/schema/beans   http://www.springframework.org/schema/beans/spring-beans.xsd">

    <bean id="processEngineConfiguration" class="org.activiti.engine.impl.cfg.StandaloneProcessEngineConfiguration" >

        <property name="databaseType" value="postgres" />
        <property name="jdbcUrl" value="jdbc:postgresql://project:5432/MYPROJECT" />
        <property name="jdbcDriver" value="org.postgresql.Driver" />
        <property name="jdbcUsername" value="me" />
        <property name="jdbcPassword" value="you" />

        <property name="databaseSchemaUpdate" value="false" />

        <property name="jobExecutorActivate" value="false" />

        <property name="history" value="full" />

        <property name="customPreVariableTypes">
            <list>
                <ref bean="activitiScriptNodeType" />
                <ref bean="activitiScriptNodeListType" />
            </list>
        </property>


        <property name="mailServerHost" value="mail.my-corp.com" />
        <property name="mailServerPort" value="5025" />
    </bean>

</beans>

I want to create activiti database on my own, by using the scripts which are available in activiti-engine-5.12.1.jar.
By default, the tables are created in public schema, but I want them to be in another schema like mySchema for example.
my questioin is how can I manage this, besides, how can I specify this in activiti.cfg.xml, to inform activiti engine api that activiti tables are in mySchema?

like image 338
Ehsan Avatar asked Oct 15 '25 17:10

Ehsan


1 Answers

I am using MySQL database for activiti, so i have got some configuration like this to creat my own schema name :

<property name="databaseType" value="mysql" />
<property name="jdbcUrl" value="jdbc:mysql://localhost:3306/activiti" />
<property name="jdbcDriver" value="com.mysql.jdbc.Driver" />
<property name="jdbcUsername" value="root" />
<property name="jdbcPassword" value="root" />

So as you using postgresql, i am not quite sure about whether the following code will work for you or not :

<?xml version='1.0' encoding='UTF-8'?>

<beans xmlns="http://www.springframework.org/schema/beans" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.springframework.org/schema/beans   http://www.springframework.org/schema/beans/spring-beans.xsd">

<bean id="processEngineConfiguration" class="org.activiti.engine.impl.cfg.StandaloneProcessEngineConfiguration" >

    <property name="databaseType" value="postgres" />
    <property name="jdbcUrl" value="jdbc:postgresql://project:5432/MYPROJECT/activiti" />
    <property name="jdbcDriver" value="org.postgresql.Driver" />
    <property name="jdbcUsername" value="me" />
    <property name="jdbcPassword" value="you" />

    <property name="databaseSchemaUpdate" value="false" />

    <property name="jobExecutorActivate" value="false" />

    <property name="history" value="full" />

    <property name="customPreVariableTypes">
        <list>
            <ref bean="activitiScriptNodeType" />
            <ref bean="activitiScriptNodeListType" />
        </list>
    </property>


    <property name="mailServerHost" value="mail.my-corp.com" />
    <property name="mailServerPort" value="5025" />
</bean>

Before deploying `activiti with new changes, mke sure that your database has the schema created.

like image 123
Madhusudan Joshi Avatar answered Oct 18 '25 06:10

Madhusudan Joshi