diff --git a/.gitignore b/.gitignore index 175d124..dec031a 100644 --- a/.gitignore +++ b/.gitignore @@ -35,4 +35,7 @@ build/ *.db application-dev.properties -application-dev.yml \ No newline at end of file +application-dev.yml + +### generated by liuibase-hiernate5 https://github.com/liquibase/liquibase/issues/2196 +derby.log \ No newline at end of file diff --git a/pom.xml b/pom.xml index e5d14f7..c0e227a 100644 --- a/pom.xml +++ b/pom.xml @@ -32,6 +32,7 @@ 4.2.0 0.8.7 3.1.2 + 4.3.5 @@ -69,6 +70,11 @@ h2 runtime + + org.liquibase + liquibase-core + ${liquibase.version} + org.springframework.boot spring-boot-starter-test @@ -139,6 +145,48 @@ + + org.liquibase + liquibase-maven-plugin + ${liquibase.version} + + + + org.liquibase.ext + liquibase-hibernate5 + 4.5.0 + + + org.springframework.boot + spring-boot-starter-data-jpa + 2.5.2 + + + javax.validation + validation-api + 2.0.1.Final + + + com.h2database + h2 + 1.4.200 + + + + src/main/resources/db/master.xml + src/main/resources/db/changelogs/diff/_changelog.xml + + org.h2.Driver + jdbc:h2:~/migration + sa + + + hibernate:spring:de.nclazz.service.mailrelay?dialect=org.hibernate.dialect.H2Dialect& + hibernate.physical\_naming\_strategy=org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy& + hibernate.implicit\_naming\_strategy=org.springframework.boot.orm.jpa.hibernate.SpringImplicitNamingStrategy + + + diff --git a/src/main/java/de/nclazz/service/mailrelay/domain/Account.java b/src/main/java/de/nclazz/service/mailrelay/domain/Account.java index 2793dd2..5ea2129 100644 --- a/src/main/java/de/nclazz/service/mailrelay/domain/Account.java +++ b/src/main/java/de/nclazz/service/mailrelay/domain/Account.java @@ -17,6 +17,7 @@ import javax.persistence.FetchType; import javax.persistence.GeneratedValue; import javax.persistence.Id; import javax.persistence.Index; +import javax.persistence.JoinColumn; import javax.persistence.OneToMany; import javax.persistence.Table; import java.util.ArrayList; @@ -50,6 +51,7 @@ public class Account { @JsonIgnore @OneToMany + @JoinColumn(name = "message_guid", referencedColumnName = "guid") private final List sentMessages = new ArrayList<>(); public static Account of(@NonNull String name, @NonNull List receivers) { diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 434fa5a..f449560 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -13,4 +13,6 @@ spring.mail.host=smtp.nclazz.de spring.mail.port=25 spring.mail.protocol=smtp -nclazz.auth.token=${AUTH_TOKEN} \ No newline at end of file +nclazz.auth.token=${AUTH_TOKEN} + +spring.liquibase.change-log=classpath:db/master.xml \ No newline at end of file diff --git a/src/main/resources/db/changelogs/01-jpa-auto-ddl-schema.xml b/src/main/resources/db/changelogs/01-jpa-auto-ddl-schema.xml new file mode 100644 index 0000000..2c19e4e --- /dev/null +++ b/src/main/resources/db/changelogs/01-jpa-auto-ddl-schema.xml @@ -0,0 +1,75 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/db/changelogs/02-renamed-join-columns.xml b/src/main/resources/db/changelogs/02-renamed-join-columns.xml new file mode 100644 index 0000000..15c0be8 --- /dev/null +++ b/src/main/resources/db/changelogs/02-renamed-join-columns.xml @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/db/master.xml b/src/main/resources/db/master.xml new file mode 100644 index 0000000..0e2e4d3 --- /dev/null +++ b/src/main/resources/db/master.xml @@ -0,0 +1,10 @@ + + + + + + \ No newline at end of file