From a17db4eeaf18b90625242c086b8c996203c522c9 Mon Sep 17 00:00:00 2001 From: Florian Gessner Date: Fri, 13 Oct 2023 20:51:22 +0200 Subject: [PATCH] #271: make message id optional --- src/main/java/de/gessnerfl/fakesmtp/model/Email.java | 8 ++++---- .../db/migration/V1_1_0__initial_table_structure.sql | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/java/de/gessnerfl/fakesmtp/model/Email.java b/src/main/java/de/gessnerfl/fakesmtp/model/Email.java index a1b2e700..20fa247d 100644 --- a/src/main/java/de/gessnerfl/fakesmtp/model/Email.java +++ b/src/main/java/de/gessnerfl/fakesmtp/model/Email.java @@ -40,8 +40,8 @@ public class Email { @Basic(optional = false) private String rawData; - @Column(name = "message_id", nullable = false) - @Basic(optional = false) + @Column(name = "message_id", nullable = true) + @Basic(optional = true) private String messageId; @OneToMany(mappedBy = "email", cascade = CascadeType.ALL, orphanRemoval = true) @@ -148,8 +148,8 @@ public List getInlineImages() { return inlineImages; } - public String getMessageId() { - return messageId; + public Optional getMessageId() { + return Optional.ofNullable(messageId); } public void setMessageId(String messageId) { diff --git a/src/main/resources/db/migration/V1_1_0__initial_table_structure.sql b/src/main/resources/db/migration/V1_1_0__initial_table_structure.sql index bda9e538..a071b49b 100644 --- a/src/main/resources/db/migration/V1_1_0__initial_table_structure.sql +++ b/src/main/resources/db/migration/V1_1_0__initial_table_structure.sql @@ -5,7 +5,7 @@ CREATE TABLE email ( subject CLOB NOT NULL, received_on TIMESTAMP NOT NULL, raw_data CLOB NOT NULL, - message_id VARCHAR(255) NOT NULL, + message_id VARCHAR(255), PRIMARY KEY (id) );