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

@@ -87,6 +87,22 @@ public class Mute {
*/
private String triggerKey;
@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();
}
@Override
public boolean equals(Object o) {
if (this == o) return true;

View File

@@ -5,6 +5,7 @@ import dev.sheldan.abstracto.core.models.database.AServer;
import lombok.*;
import javax.persistence.*;
import java.time.Instant;
import java.util.Objects;
/**
@@ -42,6 +43,22 @@ public class MuteRole {
@JoinColumn(name = "role_id", 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();
}
@Override
public boolean equals(Object o) {
if (this == o) return true;

View File

@@ -67,6 +67,23 @@ public class Warning {
@Setter
private Instant decayDate;
@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();
}
@Override
public boolean equals(Object o) {
if (this == o) return true;