From 7e983bebb98f13b9e03ac7af5ae25d34d8d01200 Mon Sep 17 00:00:00 2001 From: jendib Date: Thu, 3 Mar 2016 23:54:48 +0100 Subject: [PATCH] #67: Relations database schema --- .../docs/core/model/jpa/Contributor.java | 2 +- .../sismics/docs/core/model/jpa/Relation.java | 85 +++++++++++++++++++ .../src/main/resources/config.properties | 2 +- .../resources/db/update/dbupdate-007-0.sql | 3 + docs-web/src/dev/resources/config.properties | 2 +- docs-web/src/prod/resources/config.properties | 2 +- .../src/stress/resources/config.properties | 2 +- 7 files changed, 93 insertions(+), 5 deletions(-) create mode 100644 docs-core/src/main/java/com/sismics/docs/core/model/jpa/Relation.java create mode 100644 docs-core/src/main/resources/db/update/dbupdate-007-0.sql diff --git a/docs-core/src/main/java/com/sismics/docs/core/model/jpa/Contributor.java b/docs-core/src/main/java/com/sismics/docs/core/model/jpa/Contributor.java index 9150d937..b583a7b2 100644 --- a/docs-core/src/main/java/com/sismics/docs/core/model/jpa/Contributor.java +++ b/docs-core/src/main/java/com/sismics/docs/core/model/jpa/Contributor.java @@ -13,7 +13,7 @@ import com.google.common.base.MoreObjects; * @author bgamard */ @Entity -@Table(name = "T_Contributor") +@Table(name = "T_CONTRIBUTOR") public class Contributor { /** * Contributor ID. diff --git a/docs-core/src/main/java/com/sismics/docs/core/model/jpa/Relation.java b/docs-core/src/main/java/com/sismics/docs/core/model/jpa/Relation.java new file mode 100644 index 00000000..9eeba90f --- /dev/null +++ b/docs-core/src/main/java/com/sismics/docs/core/model/jpa/Relation.java @@ -0,0 +1,85 @@ +package com.sismics.docs.core.model.jpa; + +import java.util.Date; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Table; + +import com.google.common.base.MoreObjects; + +/** + * Relation entity. + * + * @author bgamard + */ +@Entity +@Table(name = "T_RELATION") +public class Relation { + /** + * Relation ID. + */ + @Id + @Column(name = "REL_ID_C", length = 36) + private String id; + + /** + * Source document ID. + */ + @Column(name = "REL_IDDOCFROM_C", length = 36, nullable = false) + private String fromDocumentId; + + /** + * Destination document ID. + */ + @Column(name = "REL_IDDOCTO_C", length = 36, nullable = false) + private String toDocumentId; + + /** + * Deletion date. + */ + @Column(name = "REL_DELETEDATE_D") + private Date deleteDate; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getFromDocumentId() { + return fromDocumentId; + } + + public void setFromDocumentId(String fromDocumentId) { + this.fromDocumentId = fromDocumentId; + } + + public String getToDocumentId() { + return toDocumentId; + } + + public void setToDocumentId(String toDocumentId) { + this.toDocumentId = toDocumentId; + } + + public Date getDeleteDate() { + return deleteDate; + } + + public void setDeleteDate(Date deleteDate) { + this.deleteDate = deleteDate; + } + + @Override + public String toString() { + return MoreObjects.toStringHelper(this) + .add("id", id) + .add("fromDocumentId", fromDocumentId) + .add("toDocumentId", toDocumentId) + .toString(); + } +} diff --git a/docs-core/src/main/resources/config.properties b/docs-core/src/main/resources/config.properties index cff11a73..f4e9af41 100644 --- a/docs-core/src/main/resources/config.properties +++ b/docs-core/src/main/resources/config.properties @@ -1 +1 @@ -db.version=6 \ No newline at end of file +db.version=7 \ No newline at end of file diff --git a/docs-core/src/main/resources/db/update/dbupdate-007-0.sql b/docs-core/src/main/resources/db/update/dbupdate-007-0.sql new file mode 100644 index 00000000..4a6b36ec --- /dev/null +++ b/docs-core/src/main/resources/db/update/dbupdate-007-0.sql @@ -0,0 +1,3 @@ +create cached table T_RELATION ( REL_ID_C varchar(36) not null, REL_IDDOCFROM_C varchar(36) not null, REL_IDDOCTO_C varchar(36) not null, REL_DELETEDATE_D datetime, primary key (REL_ID_C) ); + +update T_CONFIG set CFG_VALUE_C = '7' where CFG_ID_C = 'DB_VERSION'; diff --git a/docs-web/src/dev/resources/config.properties b/docs-web/src/dev/resources/config.properties index 6c2faf82..1bfb8fb0 100644 --- a/docs-web/src/dev/resources/config.properties +++ b/docs-web/src/dev/resources/config.properties @@ -1,3 +1,3 @@ api.current_version=${project.version} api.min_version=1.0 -db.version=6 \ No newline at end of file +db.version=7 \ No newline at end of file diff --git a/docs-web/src/prod/resources/config.properties b/docs-web/src/prod/resources/config.properties index 6c2faf82..1bfb8fb0 100644 --- a/docs-web/src/prod/resources/config.properties +++ b/docs-web/src/prod/resources/config.properties @@ -1,3 +1,3 @@ api.current_version=${project.version} api.min_version=1.0 -db.version=6 \ No newline at end of file +db.version=7 \ No newline at end of file diff --git a/docs-web/src/stress/resources/config.properties b/docs-web/src/stress/resources/config.properties index 6c2faf82..1bfb8fb0 100644 --- a/docs-web/src/stress/resources/config.properties +++ b/docs-web/src/stress/resources/config.properties @@ -1,3 +1,3 @@ api.current_version=${project.version} api.min_version=1.0 -db.version=6 \ No newline at end of file +db.version=7 \ No newline at end of file