Skip to content

Commit dbc08b1

Browse files
authored
Add PSQL support to the system. (#105)
1 parent 87ec4f6 commit dbc08b1

File tree

108 files changed

+2152
-3
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

108 files changed

+2152
-3
lines changed

fintrack-api/src/main/resources/application-h2.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ datasources:
99
flyway:
1010
datasources:
1111
default:
12-
locations: ["classpath:db/camunda/h2", "classpath:db/migration"]
12+
locations: ["classpath:db/camunda/h2", "classpath:db/migration/mysql"]

fintrack-api/src/main/resources/application-mysql.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,5 @@ jpa:
1414
flyway:
1515
datasources:
1616
default:
17-
locations: ["classpath:db/camunda/mysql", "classpath:db/migration"]
17+
locations: ["classpath:db/camunda/mysql", "classpath:db/migration/mysql"]
1818
validate-on-migrate: false
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
datasources:
2+
default:
3+
url: jdbc:postgresql://${DATABASE_HOST:localhost}:${DATABASE_PORT:5432}/${DATABASE_SCHEMA:pledger}
4+
driverClassName: org.postgresql.Driver
5+
username: ${DATABASE_USER:pledger}
6+
password: ${DATABASE_PASSWORD:pledger}
7+
dialect: postgres
8+
9+
jpa:
10+
default:
11+
properties:
12+
hibernate:
13+
dialect: org.hibernate.dialect.PostgreSQLDialect
14+
flyway:
15+
datasources:
16+
default:
17+
locations: ["classpath:db/camunda/psql", "classpath:db/migration/psql"]
18+
validate-on-migrate: false

jpa-repository/build.gradle.kts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,10 @@ dependencies {
2525
implementation(project(":domain"))
2626

2727
runtimeOnly(mn.h2)
28+
runtimeOnly(mn.postgresql)
2829
runtimeOnly(mn.mysql.connector.java)
2930
runtimeOnly(mn.flyway.mysql)
31+
runtimeOnly(mn.flyway.postgresql)
3032

3133
runtimeOnly(mn.snakeyaml)
3234
testRuntimeOnly(mn.logback.classic)
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
--
2+
-- Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
3+
-- under one or more contributor license agreements. See the NOTICE file
4+
-- distributed with this work for additional information regarding copyright
5+
-- ownership. Camunda licenses this file to you under the Apache License,
6+
-- Version 2.0; you may not use this file except in compliance with the License.
7+
-- You may obtain a copy of the License at
8+
--
9+
-- http://www.apache.org/licenses/LICENSE-2.0
10+
--
11+
-- Unless required by applicable law or agreed to in writing, software
12+
-- distributed under the License is distributed on an "AS IS" BASIS,
13+
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
-- See the License for the specific language governing permissions and
15+
-- limitations under the License.
16+
--
17+
18+
-- create decision definition table --
19+
create table ACT_RE_DECISION_DEF (
20+
ID_ varchar(64) NOT NULL,
21+
REV_ integer,
22+
CATEGORY_ varchar(255),
23+
NAME_ varchar(255),
24+
KEY_ varchar(255) NOT NULL,
25+
VERSION_ integer NOT NULL,
26+
DEPLOYMENT_ID_ varchar(64),
27+
RESOURCE_NAME_ varchar(4000),
28+
DGRM_RESOURCE_NAME_ varchar(4000),
29+
DEC_REQ_ID_ varchar(64),
30+
DEC_REQ_KEY_ varchar(255),
31+
TENANT_ID_ varchar(64),
32+
HISTORY_TTL_ integer,
33+
VERSION_TAG_ varchar(64),
34+
primary key (ID_)
35+
);
36+
37+
-- create decision requirements definition table --
38+
create table ACT_RE_DECISION_REQ_DEF (
39+
ID_ varchar(64) NOT NULL,
40+
REV_ integer,
41+
CATEGORY_ varchar(255),
42+
NAME_ varchar(255),
43+
KEY_ varchar(255) NOT NULL,
44+
VERSION_ integer NOT NULL,
45+
DEPLOYMENT_ID_ varchar(64),
46+
RESOURCE_NAME_ varchar(4000),
47+
DGRM_RESOURCE_NAME_ varchar(4000),
48+
TENANT_ID_ varchar(64),
49+
primary key (ID_)
50+
);
51+
52+
alter table ACT_RE_DECISION_DEF
53+
add constraint ACT_FK_DEC_REQ
54+
foreign key (DEC_REQ_ID_)
55+
references ACT_RE_DECISION_REQ_DEF(ID_);
56+
57+
create index ACT_IDX_DEC_DEF_TENANT_ID on ACT_RE_DECISION_DEF(TENANT_ID_);
58+
create index ACT_IDX_DEC_DEF_REQ_ID on ACT_RE_DECISION_DEF(DEC_REQ_ID_);
59+
create index ACT_IDX_DEC_REQ_DEF_TENANT_ID on ACT_RE_DECISION_REQ_DEF(TENANT_ID_);
Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
--
2+
-- Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
3+
-- under one or more contributor license agreements. See the NOTICE file
4+
-- distributed with this work for additional information regarding copyright
5+
-- ownership. Camunda licenses this file to you under the Apache License,
6+
-- Version 2.0; you may not use this file except in compliance with the License.
7+
-- You may obtain a copy of the License at
8+
--
9+
-- http://www.apache.org/licenses/LICENSE-2.0
10+
--
11+
-- Unless required by applicable law or agreed to in writing, software
12+
-- distributed under the License is distributed on an "AS IS" BASIS,
13+
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
-- See the License for the specific language governing permissions and
15+
-- limitations under the License.
16+
--
17+
18+
-- create case definition table --
19+
20+
create table ACT_RE_CASE_DEF (
21+
ID_ varchar(64) NOT NULL,
22+
REV_ integer,
23+
CATEGORY_ varchar(255),
24+
NAME_ varchar(255),
25+
KEY_ varchar(255) NOT NULL,
26+
VERSION_ integer NOT NULL,
27+
DEPLOYMENT_ID_ varchar(64),
28+
RESOURCE_NAME_ varchar(4000),
29+
DGRM_RESOURCE_NAME_ varchar(4000),
30+
TENANT_ID_ varchar(64),
31+
HISTORY_TTL_ integer,
32+
primary key (ID_)
33+
);
34+
35+
-- create case execution table --
36+
37+
create table ACT_RU_CASE_EXECUTION (
38+
ID_ varchar(64) NOT NULL,
39+
REV_ integer,
40+
CASE_INST_ID_ varchar(64),
41+
SUPER_CASE_EXEC_ varchar(64),
42+
SUPER_EXEC_ varchar(64),
43+
BUSINESS_KEY_ varchar(255),
44+
PARENT_ID_ varchar(64),
45+
CASE_DEF_ID_ varchar(64),
46+
ACT_ID_ varchar(255),
47+
PREV_STATE_ integer,
48+
CURRENT_STATE_ integer,
49+
REQUIRED_ boolean,
50+
TENANT_ID_ varchar(64),
51+
primary key (ID_)
52+
);
53+
54+
-- create case sentry part table --
55+
56+
create table ACT_RU_CASE_SENTRY_PART (
57+
ID_ varchar(64) NOT NULL,
58+
REV_ integer,
59+
CASE_INST_ID_ varchar(64),
60+
CASE_EXEC_ID_ varchar(64),
61+
SENTRY_ID_ varchar(255),
62+
TYPE_ varchar(255),
63+
SOURCE_CASE_EXEC_ID_ varchar(64),
64+
STANDARD_EVENT_ varchar(255),
65+
SOURCE_ varchar(255),
66+
VARIABLE_EVENT_ varchar(255),
67+
VARIABLE_NAME_ varchar(255),
68+
SATISFIED_ boolean,
69+
TENANT_ID_ varchar(64),
70+
primary key (ID_)
71+
);
72+
73+
-- create index on business key --
74+
create index ACT_IDX_CASE_EXEC_BUSKEY on ACT_RU_CASE_EXECUTION(BUSINESS_KEY_);
75+
76+
-- create foreign key constraints on ACT_RU_CASE_EXECUTION --
77+
create index ACT_IDX_CASE_EXE_CASE_INST on ACT_RU_CASE_EXECUTION(CASE_INST_ID_);
78+
alter table ACT_RU_CASE_EXECUTION
79+
add constraint ACT_FK_CASE_EXE_CASE_INST
80+
foreign key (CASE_INST_ID_)
81+
references ACT_RU_CASE_EXECUTION(ID_);
82+
83+
create index ACT_IDX_CASE_EXE_PARENT on ACT_RU_CASE_EXECUTION(PARENT_ID_);
84+
alter table ACT_RU_CASE_EXECUTION
85+
add constraint ACT_FK_CASE_EXE_PARENT
86+
foreign key (PARENT_ID_)
87+
references ACT_RU_CASE_EXECUTION(ID_);
88+
89+
create index ACT_IDX_CASE_EXE_CASE_DEF on ACT_RU_CASE_EXECUTION(CASE_DEF_ID_);
90+
alter table ACT_RU_CASE_EXECUTION
91+
add constraint ACT_FK_CASE_EXE_CASE_DEF
92+
foreign key (CASE_DEF_ID_)
93+
references ACT_RE_CASE_DEF(ID_);
94+
95+
-- create foreign key constraints on ACT_RU_VARIABLE --
96+
create index ACT_IDX_VAR_CASE_EXE on ACT_RU_VARIABLE(CASE_EXECUTION_ID_);
97+
alter table ACT_RU_VARIABLE
98+
add constraint ACT_FK_VAR_CASE_EXE
99+
foreign key (CASE_EXECUTION_ID_)
100+
references ACT_RU_CASE_EXECUTION(ID_);
101+
102+
create index ACT_IDX_VAR_CASE_INST_ID on ACT_RU_VARIABLE(CASE_INST_ID_);
103+
alter table ACT_RU_VARIABLE
104+
add constraint ACT_FK_VAR_CASE_INST
105+
foreign key (CASE_INST_ID_)
106+
references ACT_RU_CASE_EXECUTION(ID_);
107+
108+
-- create foreign key constraints on ACT_RU_TASK --
109+
create index ACT_IDX_TASK_CASE_EXEC on ACT_RU_TASK(CASE_EXECUTION_ID_);
110+
alter table ACT_RU_TASK
111+
add constraint ACT_FK_TASK_CASE_EXE
112+
foreign key (CASE_EXECUTION_ID_)
113+
references ACT_RU_CASE_EXECUTION(ID_);
114+
115+
create index ACT_IDX_TASK_CASE_DEF_ID on ACT_RU_TASK(CASE_DEF_ID_);
116+
alter table ACT_RU_TASK
117+
add constraint ACT_FK_TASK_CASE_DEF
118+
foreign key (CASE_DEF_ID_)
119+
references ACT_RE_CASE_DEF(ID_);
120+
121+
-- create foreign key constraints on ACT_RU_CASE_SENTRY_PART --
122+
create index ACT_IDX_CASE_SENTRY_CASE_INST on ACT_RU_CASE_SENTRY_PART(CASE_INST_ID_);
123+
alter table ACT_RU_CASE_SENTRY_PART
124+
add constraint ACT_FK_CASE_SENTRY_CASE_INST
125+
foreign key (CASE_INST_ID_)
126+
references ACT_RU_CASE_EXECUTION(ID_);
127+
128+
create index ACT_IDX_CASE_SENTRY_CASE_EXEC on ACT_RU_CASE_SENTRY_PART(CASE_EXEC_ID_);
129+
alter table ACT_RU_CASE_SENTRY_PART
130+
add constraint ACT_FK_CASE_SENTRY_CASE_EXEC
131+
foreign key (CASE_EXEC_ID_)
132+
references ACT_RU_CASE_EXECUTION(ID_);
133+
134+
create index ACT_IDX_CASE_DEF_TENANT_ID on ACT_RE_CASE_DEF(TENANT_ID_);
135+
create index ACT_IDX_CASE_EXEC_TENANT_ID on ACT_RU_CASE_EXECUTION(TENANT_ID_);
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
--
2+
-- Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
3+
-- under one or more contributor license agreements. See the NOTICE file
4+
-- distributed with this work for additional information regarding copyright
5+
-- ownership. Camunda licenses this file to you under the Apache License,
6+
-- Version 2.0; you may not use this file except in compliance with the License.
7+
-- You may obtain a copy of the License at
8+
--
9+
-- http://www.apache.org/licenses/LICENSE-2.0
10+
--
11+
-- Unless required by applicable law or agreed to in writing, software
12+
-- distributed under the License is distributed on an "AS IS" BASIS,
13+
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
-- See the License for the specific language governing permissions and
15+
-- limitations under the License.
16+
--
17+
18+
create table ACT_HI_CASEINST (
19+
ID_ varchar(64) not null,
20+
CASE_INST_ID_ varchar(64) not null,
21+
BUSINESS_KEY_ varchar(255),
22+
CASE_DEF_ID_ varchar(64) not null,
23+
CREATE_TIME_ timestamp not null,
24+
CLOSE_TIME_ timestamp,
25+
DURATION_ bigint,
26+
STATE_ integer,
27+
CREATE_USER_ID_ varchar(255),
28+
SUPER_CASE_INSTANCE_ID_ varchar(64),
29+
SUPER_PROCESS_INSTANCE_ID_ varchar(64),
30+
TENANT_ID_ varchar(64),
31+
primary key (ID_),
32+
unique (CASE_INST_ID_)
33+
);
34+
35+
create table ACT_HI_CASEACTINST (
36+
ID_ varchar(64) not null,
37+
PARENT_ACT_INST_ID_ varchar(64),
38+
CASE_DEF_ID_ varchar(64) not null,
39+
CASE_INST_ID_ varchar(64) not null,
40+
CASE_ACT_ID_ varchar(255) not null,
41+
TASK_ID_ varchar(64),
42+
CALL_PROC_INST_ID_ varchar(64),
43+
CALL_CASE_INST_ID_ varchar(64),
44+
CASE_ACT_NAME_ varchar(255),
45+
CASE_ACT_TYPE_ varchar(255),
46+
CREATE_TIME_ timestamp not null,
47+
END_TIME_ timestamp,
48+
DURATION_ bigint,
49+
STATE_ integer,
50+
REQUIRED_ boolean,
51+
TENANT_ID_ varchar(64),
52+
primary key (ID_)
53+
);
54+
55+
create index ACT_IDX_HI_CAS_I_CLOSE on ACT_HI_CASEINST(CLOSE_TIME_);
56+
create index ACT_IDX_HI_CAS_I_BUSKEY on ACT_HI_CASEINST(BUSINESS_KEY_);
57+
create index ACT_IDX_HI_CAS_I_TENANT_ID on ACT_HI_CASEINST(TENANT_ID_);
58+
create index ACT_IDX_HI_CAS_A_I_CREATE on ACT_HI_CASEACTINST(CREATE_TIME_);
59+
create index ACT_IDX_HI_CAS_A_I_END on ACT_HI_CASEACTINST(END_TIME_);
60+
create index ACT_IDX_HI_CAS_A_I_COMP on ACT_HI_CASEACTINST(CASE_ACT_ID_, END_TIME_, ID_);
61+
create index ACT_IDX_HI_CAS_A_I_TENANT_ID on ACT_HI_CASEACTINST(TENANT_ID_);

0 commit comments

Comments
 (0)