Skip to content

Commit

Permalink
Modified column names with reserved words
Browse files Browse the repository at this point in the history
Signed-off-by: Deepak Joseph <deepakjoseph305@gmail.com>
  • Loading branch information
josedee committed Nov 5, 2024
1 parent d2dc0c1 commit c3fe6d3
Show file tree
Hide file tree
Showing 8 changed files with 95 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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<String, String> metadata;

@Id
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<String> 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<String, String> metadata;

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Original file line number Diff line number Diff line change
@@ -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;
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
@@ -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;

0 comments on commit c3fe6d3

Please sign in to comment.