cancel
Showing results for 
Search instead for 
Did you mean: 

Alter DB Schema via executeCustomSQL

fnoorie
Champ in-the-making
Champ in-the-making
Hi,

I am running into the issue where the absolute path where my service gets deployed to is ridiculously long (I cant point it to a different path due to some company infra policy). This is causing issues when creating the tables in h2:

### SQL: insert into ACT_GE_BYTEARRAY(ID_, REV_, NAME_, BYTES_, DEPLOYMENT_ID_, GENERATED_) values (?, 1, ?, ?, ?, ?)
### Cause: org.h2.jdbc.JdbcSQLException: Value too long for column "NAME_ VARCHAR(255)": "'/***Veryyy long path***/ (306)"; SQL statement:
insert into ACT_GE_BYTEARRAY(ID_, REV_, NAME_, BYTES_, DEPLOYMENT_ID_, GENERATED_)

Is there a way to alter db when it starts up via code. Ideally I would like to create/drop db when the service starts/stops (i know how to do this) and alter db right after the service starts.

I tried via executeCustomSQL available on managementService but I guess that doesnt support ALTER.

Appreciate your help.
3 REPLIES 3

jbarrez
Star Contributor
Star Contributor
If your database user has the rights to execute ALTER, there is no reason why you shouldn't be able to do it.

But im seriously wondering why a deployment name needs to be that long Smiley Tongue

fnoorie
Champ in-the-making
Champ in-the-making
Thanks Joram but my requirement is a bit different. When activiti-engine starts up it creates this table and inserts the process's absolute path (where it fails because of the long name). So is there a way to alter the table right when the engine starts up? (I can use jdbc to do it but that will be overwritten when the engine starts up)

jbarrez
Star Contributor
Star Contributor
Hmm, no, there is no hookpoint for that I guess. Maybe ProcessEngineLifecycleListener might be something?