Skip to content

Commit cbd02b3

Browse files
Rename columns named value
This addresses #660. `value` is a keyword in SQL. This used to not be an issue, and it continues to work with MariaDB and Postgres, but newer versions of h2, specifically the one used in Opencast, choke on this. I tried to work around this using quoting, but Postgres treats quoted identifiers in a non-standard way, so that doesn't work cross-platform, either. I opted to just rename the columns `value_`, which is [not ideal](#663), but since this targets `stable`, it's the simplest way to handle forward merges. Note, that you need to migrate your database! Due to the exact compatibility issues this is trying to fix, it's hard to provide a portable script. Please refer to the documentation of your respective database to do something to the effect of ```sql alter table xannotations_annotation_tags rename column value to value_; alter table xannotations_category_tags rename column value to value_; alter table xannotations_comment_tags rename column value to value_; alter table xannotations_label_tags rename column value to value_; alter table xannotations_scale_tags rename column value to value_; alter table xannotations_scale_value_tags rename column value to value_; alter table xannotations_track_tags rename column value to value_; alter table xannotations_user_tags rename column value to value_; alter table xannotations_video_tags rename column value to value_; alter table xannotations_label rename column value to value_; alter table xannotations_scale_value rename column value to value_; ```
1 parent 88e035a commit cbd02b3

File tree

9 files changed

+11
-11
lines changed

9 files changed

+11
-11
lines changed

opencast-backend/annotation-impl/src/main/java/org/opencast/annotation/impl/persistence/AnnotationDto.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ public class AnnotationDto extends AbstractResourceDto {
103103

104104
@ElementCollection
105105
@MapKeyColumn(name = "name")
106-
@Column(name = "value")
106+
@Column(name = "value_")
107107
@CollectionTable(name = "xannotations_annotation_tags", joinColumns = @JoinColumn(name = "annotation_id"))
108108
protected Map<String, String> tags = new HashMap<String, String>();
109109

opencast-backend/annotation-impl/src/main/java/org/opencast/annotation/impl/persistence/CategoryDto.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ public class CategoryDto extends AbstractResourceDto {
101101

102102
@ElementCollection
103103
@MapKeyColumn(name = "name")
104-
@Column(name = "value")
104+
@Column(name = "value_")
105105
@CollectionTable(name = "xannotations_category_tags", joinColumns = @JoinColumn(name = "category_id"))
106106
protected Map<String, String> tags = new HashMap<String, String>();
107107

opencast-backend/annotation-impl/src/main/java/org/opencast/annotation/impl/persistence/CommentDto.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ public class CommentDto extends AbstractResourceDto {
8989

9090
@ElementCollection
9191
@MapKeyColumn(name = "name")
92-
@Column(name = "value")
92+
@Column(name = "value_")
9393
@CollectionTable(name = "xannotations_comment_tags", joinColumns = @JoinColumn(name = "comment_id"))
9494
protected Map<String, String> tags = new HashMap<String, String>();
9595

opencast-backend/annotation-impl/src/main/java/org/opencast/annotation/impl/persistence/LabelDto.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ public class LabelDto extends AbstractResourceDto {
7777
@Column(name = "series_label_id")
7878
private Long seriesLabelId;
7979

80-
@Column(name = "value", nullable = false)
80+
@Column(name = "value_", nullable = false)
8181
private String value;
8282

8383
@Column(name = "abbreviation", nullable = false)
@@ -95,7 +95,7 @@ public class LabelDto extends AbstractResourceDto {
9595

9696
@ElementCollection
9797
@MapKeyColumn(name = "name")
98-
@Column(name = "value")
98+
@Column(name = "value_")
9999
@CollectionTable(name = "xannotations_label_tags", joinColumns = @JoinColumn(name = "label_id"))
100100
protected Map<String, String> tags = new HashMap<String, String>();
101101

opencast-backend/annotation-impl/src/main/java/org/opencast/annotation/impl/persistence/ScaleDto.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ public class ScaleDto extends AbstractResourceDto {
8787

8888
@ElementCollection
8989
@MapKeyColumn(name = "name")
90-
@Column(name = "value")
90+
@Column(name = "value_")
9191
@CollectionTable(name = "xannotations_scale_tags", joinColumns = @JoinColumn(name = "scale_id"))
9292
protected Map<String, String> tags = new HashMap<String, String>();
9393

opencast-backend/annotation-impl/src/main/java/org/opencast/annotation/impl/persistence/ScaleValueDto.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ public class ScaleValueDto extends AbstractResourceDto {
7575
@Column(name = "name", nullable = false)
7676
private String name;
7777

78-
@Column(name = "value", nullable = false)
78+
@Column(name = "value_", nullable = false)
7979
private double value;
8080

8181
@Column(name = "order_value", nullable = false)
@@ -87,7 +87,7 @@ public class ScaleValueDto extends AbstractResourceDto {
8787

8888
@ElementCollection
8989
@MapKeyColumn(name = "name")
90-
@Column(name = "value")
90+
@Column(name = "value_")
9191
@CollectionTable(name = "xannotations_scale_value_tags", joinColumns = @JoinColumn(name = "scale_value_id"))
9292
protected Map<String, String> tags = new HashMap<String, String>();
9393

opencast-backend/annotation-impl/src/main/java/org/opencast/annotation/impl/persistence/TrackDto.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ public class TrackDto extends AbstractResourceDto {
8787

8888
@ElementCollection
8989
@MapKeyColumn(name = "name")
90-
@Column(name = "value")
90+
@Column(name = "value_")
9191
@CollectionTable(name = "xannotations_track_tags", joinColumns = @JoinColumn(name = "track_id"))
9292
protected Map<String, String> tags = new HashMap<String, String>();
9393

opencast-backend/annotation-impl/src/main/java/org/opencast/annotation/impl/persistence/UserDto.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ public class UserDto extends AbstractResourceDto {
8484

8585
@ElementCollection
8686
@MapKeyColumn(name = "name")
87-
@Column(name = "value")
87+
@Column(name = "value_")
8888
@CollectionTable(name = "xannotations_user_tags", joinColumns = @JoinColumn(name = "user_id"))
8989
protected Map<String, String> tags = new HashMap<String, String>();
9090

opencast-backend/annotation-impl/src/main/java/org/opencast/annotation/impl/persistence/VideoDto.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public final class VideoDto extends AbstractResourceDto {
7373

7474
@ElementCollection
7575
@MapKeyColumn(name = "name")
76-
@Column(name = "value")
76+
@Column(name = "value_")
7777
@CollectionTable(name = "xannotations_video_tags", joinColumns = @JoinColumn(name = "video_id"))
7878
protected Map<String, String> tags = new HashMap<String, String>();
7979

0 commit comments

Comments
 (0)