diff --git a/data-index/data-index-storage/data-index-storage-jpa-common/src/main/java/org/kie/kogito/index/jpa/model/NodeEntity.java b/data-index/data-index-storage/data-index-storage-jpa-common/src/main/java/org/kie/kogito/index/jpa/model/NodeEntity.java index 7eaab4dfd1..f5df6bab66 100644 --- a/data-index/data-index-storage/data-index-storage-jpa-common/src/main/java/org/kie/kogito/index/jpa/model/NodeEntity.java +++ b/data-index/data-index-storage/data-index-storage-jpa-common/src/main/java/org/kie/kogito/index/jpa/model/NodeEntity.java @@ -53,8 +53,8 @@ public class NodeEntity extends AbstractEntity { @CollectionTable(name = "definitions_nodes_metadata", joinColumns = { @JoinColumn(name = "node_id", referencedColumnName = "id"), @JoinColumn(name = "process_id", referencedColumnName = "process_id"), @JoinColumn(name = "process_version", referencedColumnName = "process_version") }, foreignKey = @ForeignKey(name = "fk_definitions_nodes_metadata_definitions_nodes")) - @MapKeyColumn(name = "key") - @Column(name = "value") + @MapKeyColumn(name = "metadata_key") + @Column(name = "metadata_value") private Map metadata; @Id diff --git a/data-index/data-index-storage/data-index-storage-jpa-common/src/main/java/org/kie/kogito/index/jpa/model/ProcessDefinitionEntity.java b/data-index/data-index-storage/data-index-storage-jpa-common/src/main/java/org/kie/kogito/index/jpa/model/ProcessDefinitionEntity.java index 100dc79c16..36251279d3 100644 --- a/data-index/data-index-storage/data-index-storage-jpa-common/src/main/java/org/kie/kogito/index/jpa/model/ProcessDefinitionEntity.java +++ b/data-index/data-index-storage/data-index-storage-jpa-common/src/main/java/org/kie/kogito/index/jpa/model/ProcessDefinitionEntity.java @@ -72,14 +72,14 @@ public class ProcessDefinitionEntity extends AbstractEntity { @ElementCollection @CollectionTable(name = "definitions_annotations", joinColumns = { @JoinColumn(name = "process_id", referencedColumnName = "id"), @JoinColumn(name = "process_version", referencedColumnName = "version") }, foreignKey = @ForeignKey(name = "fk_definitions_annotations")) - @Column(name = "value") + @Column(name = "annotation") private Set annotations; @ElementCollection @CollectionTable(name = "definitions_metadata", joinColumns = { @JoinColumn(name = "process_id", referencedColumnName = "id"), @JoinColumn(name = "process_version", referencedColumnName = "version") }, foreignKey = @ForeignKey(name = "fk_definitions_metadata")) - @MapKeyColumn(name = "key") - @Column(name = "value") + @MapKeyColumn(name = "metadata_key") + @Column(name = "metadata_value") private Map metadata; @Override diff --git a/data-index/data-index-storage/data-index-storage-jpa/src/main/resources/kie-flyway/db/data-index/ansi/V1.45.0.6__modify_columns_with_reserved_words.sql b/data-index/data-index-storage/data-index-storage-jpa/src/main/resources/kie-flyway/db/data-index/ansi/V1.45.0.6__modify_columns_with_reserved_words.sql new file mode 100644 index 0000000000..016f0bc997 --- /dev/null +++ b/data-index/data-index-storage/data-index-storage-jpa/src/main/resources/kie-flyway/db/data-index/ansi/V1.45.0.6__modify_columns_with_reserved_words.sql @@ -0,0 +1,24 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +alter table definitions_nodes_metadata alter column key rename to metadata_key; +alter table definitions_nodes_metadata alter column value rename to metadata_value; +alter table definitions_metadata alter column key rename to metadata_key; +alter table definitions_metadata alter column value rename to metadata_value; +alter table definitions_annotations alter column value rename to annotation; diff --git a/data-index/data-index-storage/data-index-storage-postgresql/src/main/resources/kie-flyway/db/data-index/postgresql/V1.45.0.6__modify_columns_with_reserved_words.sql b/data-index/data-index-storage/data-index-storage-postgresql/src/main/resources/kie-flyway/db/data-index/postgresql/V1.45.0.6__modify_columns_with_reserved_words.sql new file mode 100644 index 0000000000..bef1dc9532 --- /dev/null +++ b/data-index/data-index-storage/data-index-storage-postgresql/src/main/resources/kie-flyway/db/data-index/postgresql/V1.45.0.6__modify_columns_with_reserved_words.sql @@ -0,0 +1,24 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +alter table definitions_nodes_metadata rename column key to metadata_key; +alter table definitions_nodes_metadata rename column value to metadata_value; +alter table definitions_metadata rename column key to metadata_key; +alter table definitions_metadata rename column value to metadata_value; +alter table definitions_annotations rename column value to annotation; diff --git a/persistence-commons/persistence-commons-jpa-base/src/main/java/org/kie/kogito/persistence/postgresql/model/CacheEntity.java b/persistence-commons/persistence-commons-jpa-base/src/main/java/org/kie/kogito/persistence/postgresql/model/CacheEntity.java index 0fac442af7..a81555194f 100644 --- a/persistence-commons/persistence-commons-jpa-base/src/main/java/org/kie/kogito/persistence/postgresql/model/CacheEntity.java +++ b/persistence-commons/persistence-commons-jpa-base/src/main/java/org/kie/kogito/persistence/postgresql/model/CacheEntity.java @@ -44,7 +44,7 @@ public class CacheEntity { private String name; @Id - @Column(nullable = false) + @Column(name = "cache_key", nullable = false) private String key; @Convert(converter = JsonBinaryConverter.class) diff --git a/persistence-commons/persistence-commons-jpa/src/main/resources/kie-flyway/db/persistence-commons/ansi/V1.5.1__modify_columns_with_reserved_words.sql b/persistence-commons/persistence-commons-jpa/src/main/resources/kie-flyway/db/persistence-commons/ansi/V1.5.1__modify_columns_with_reserved_words.sql new file mode 100644 index 0000000000..af5124a026 --- /dev/null +++ b/persistence-commons/persistence-commons-jpa/src/main/resources/kie-flyway/db/persistence-commons/ansi/V1.5.1__modify_columns_with_reserved_words.sql @@ -0,0 +1,20 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +alter table kogito_data_cache alter column key rename to cache_key; \ 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 b152f39073..4916f1cd72 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 @@ -19,7 +19,7 @@ create table if not exists kogito_data_cache ( - key varchar(255) not null, + cache_key varchar(255) not null, name varchar(255) not null, json_value jsonb, primary key (key, name) diff --git a/persistence-commons/persistence-commons-postgresql/src/main/resources/kie-flyway/db/persistence-commons/postgresql/V1.5.1__modify_columns_with_reserved_words.sql b/persistence-commons/persistence-commons-postgresql/src/main/resources/kie-flyway/db/persistence-commons/postgresql/V1.5.1__modify_columns_with_reserved_words.sql new file mode 100644 index 0000000000..4661a811b6 --- /dev/null +++ b/persistence-commons/persistence-commons-postgresql/src/main/resources/kie-flyway/db/persistence-commons/postgresql/V1.5.1__modify_columns_with_reserved_words.sql @@ -0,0 +1,20 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +alter table kogito_data_cache rename column key to cache_key;