added columns for tracking created/updated

This commit is contained in:
Sheldan
2020-05-16 00:21:53 +02:00
parent 82c63d4825
commit ddb540ccfe
26 changed files with 385 additions and 7 deletions

View File

@@ -5,6 +5,7 @@ import lombok.*;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import javax.persistence.*;
import java.time.Instant;
@Builder
@Entity
@@ -31,4 +32,12 @@ public class ModMailMessage {
private Boolean dmChannel;
private Boolean anonymous;
@Column(name = "created")
private Instant created;
@PrePersist
private void onInsert() {
this.created = Instant.now();
}
}

View File

@@ -6,6 +6,7 @@ import lombok.*;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import javax.persistence.*;
import java.time.Instant;
@Builder
@Entity
@@ -29,4 +30,20 @@ public class ModMailRole {
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "modmail_role", nullable = false)
private ARole role;
@Column(name = "created")
private Instant created;
@PrePersist
private void onInsert() {
this.created = Instant.now();
}
@Column(name = "updated")
private Instant updated;
@PreUpdate
private void onUpdate() {
this.updated = Instant.now();
}
}

View File

@@ -37,12 +37,22 @@ public class ModMailThread {
@JoinColumn(name = "modmail_thread_server", nullable = false)
private AServer server;
@Column
@Column(name = "created")
private Instant created;
@Column
@PrePersist
private void onInsert() {
this.created = Instant.now();
}
@Column(name = "updated")
private Instant updated;
@PreUpdate
private void onUpdate() {
this.updated = Instant.now();
}
@Column
private Instant closed;

View File

@@ -5,6 +5,7 @@ import lombok.*;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import javax.persistence.*;
import java.time.Instant;
@Builder
@Entity
@@ -28,4 +29,13 @@ public class ModMailThreadSubscriber {
@ManyToOne(cascade = {CascadeType.PERSIST, CascadeType.MERGE})
@JoinColumn(name = "modMailThread", nullable = false)
private ModMailThread threadReference;
@Column(name = "created")
private Instant created;
@PrePersist
private void onInsert() {
this.created = Instant.now();
}
}