cancel
Showing results for 
Search instead for 
Did you mean: 

Rename tables in the database

aitor
Champ in-the-making
Champ in-the-making
Hello,

Is it possible to rename the tables in the database from ACT_XXXX to BPM_XXXX, for example, without overwriting the API?

In my application "ACT_" acronym is reserved for ACTION data tables.

Thanks.
2 REPLIES 2

frederikherema1
Star Contributor
Star Contributor
You can have table-prefixed for the tables, to overcome issues with clashing names. Renaming the whole table is not possible. So you could have an BPM_ACT_RU_EXECUTION table, but not a BPM_RU_EXECUTION table (at least, not without forking activiti Smiley Wink).

Prefix can be configured using property "databaseTablePrefix" on the processEngineConfiguration:


/**
   * Allows configuring a database table prefix which is used for all runtime operations of the process engine.
   * For example, if you specify a prefix named 'PRE1.', activiti will query for executions in a table named
   * 'PRE1.ACT_RU_EXECUTION_'.
   *
   * <p />
   * <strong>NOTE: the prefix is not respected by automatic database schema management. If you use
   * {@link ProcessEngineConfiguration#DB_SCHEMA_UPDATE_CREATE_DROP}
   * or {@link ProcessEngineConfiguration#DB_SCHEMA_UPDATE_TRUE}, activiti will create the database tables
   * using the default names, regardless of the prefix configured here.</strong> 
   *
   * @since 5.9
   */
  protected String databaseTablePrefix = "";

You should manually create the tables using the prefix. Look for the right files in github or in the engine jar (each DB has a set of *create*.sql files). Alter those to respect the prefix you set. From that point on, if the engine boots, the prefix will be used.


/modules/activiti-engine/src/main/resources/org/activiti/db/create/activiti.h2.create.engine.sql

aitor
Champ in-the-making
Champ in-the-making
Perfect!!!

I tried it and all ok. It's what I needed.

Thank you very much.