This is an automated email from the ASF dual-hosted git repository.
nmirasch pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-kie-kogito-apps.git
The following commit(s) were added to refs/heads/main by this push:
new 2866ed039 incubator-kie-kogito-apps-issues#1964: Allow multiple
execution of dataindex postgresql migration scripts (#1966)
2866ed039 is described below
commit 2866ed0397d2ec743980ac9cb765246c71320a1c
Author: nmirasch <[email protected]>
AuthorDate: Thu Jan 25 18:39:05 2024 +0100
incubator-kie-kogito-apps-issues#1964: Allow multiple execution of
dataindex postgresql migration scripts (#1966)
---
... V1.45.0.2__data_index_definitions_add_columns.sql} | 18 +++++++++++++-----
.../src/main/resources/cache_entity_create.sql | 2 +-
2 files changed, 14 insertions(+), 6 deletions(-)
diff --git
a/data-index/data-index-storage/data-index-storage-postgresql/src/main/resources/db/migration/V1.45.0.2__data_index_definitions_add_collums.sql
b/data-index/data-index-storage/data-index-storage-postgresql/src/main/resources/db/migration/V1.45.0.2__data_index_definitions_add_columns.sql
similarity index 68%
rename from
data-index/data-index-storage/data-index-storage-postgresql/src/main/resources/db/migration/V1.45.0.2__data_index_definitions_add_collums.sql
rename to
data-index/data-index-storage/data-index-storage-postgresql/src/main/resources/db/migration/V1.45.0.2__data_index_definitions_add_columns.sql
index c976a3ee0..0506531e0 100644
---
a/data-index/data-index-storage/data-index-storage-postgresql/src/main/resources/db/migration/V1.45.0.2__data_index_definitions_add_collums.sql
+++
b/data-index/data-index-storage/data-index-storage-postgresql/src/main/resources/db/migration/V1.45.0.2__data_index_definitions_add_columns.sql
@@ -1,19 +1,23 @@
-create table definitions_annotations
+create table IF NOT EXISTS definitions_annotations
(
value varchar(255) not null,
process_id varchar(255) not null,
process_version varchar(255) not null,
primary key (value, process_id, process_version)
-);
+ );
-create table definitions_metadata
+create table IF NOT EXISTS definitions_metadata
(
process_id varchar(255) not null,
process_version varchar(255) not null,
value varchar(255),
key varchar(255) not null,
primary key (process_id, process_version, key)
-);
+ );
+
+alter table if exists definitions_annotations
+drop constraint if exists fk_definitions_annotations
+cascade;
alter table if exists definitions_annotations
add constraint fk_definitions_annotations
@@ -23,6 +27,10 @@ alter table if exists definitions_annotations
delete
cascade;
+alter table if exists definitions_metadata
+drop constraint if exists fk_definitions_metadata
+cascade;
+
alter table if exists definitions_metadata
add constraint fk_definitions_metadata
foreign key (process_id, process_version)
@@ -32,4 +40,4 @@ delete
cascade;
alter table if exists definitions
- add column description varchar (255);
\ No newline at end of file
+ add column IF NOT EXISTS description varchar (255);
\ No newline at end of file
diff --git
a/persistence-commons/persistence-commons-postgresql/src/main/resources/cache_entity_create.sql
b/persistence-commons/persistence-commons-postgresql/src/main/resources/cache_entity_create.sql
index e24b58fdd..74c48518d 100644
---
a/persistence-commons/persistence-commons-postgresql/src/main/resources/cache_entity_create.sql
+++
b/persistence-commons/persistence-commons-postgresql/src/main/resources/cache_entity_create.sql
@@ -1,5 +1,5 @@
-create table kogito_data_cache (
+create table if not exists kogito_data_cache (
key varchar(255) not null,
name varchar(255) not null,
json_value jsonb,
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]