mirror of
https://github.com/Sheldan/abstracto.git
synced 2026-04-18 12:57:39 +00:00
[AB-263] adding stricter not null checks to database, disabling updates/inserts for created and updated columns to only rely on triggers
This commit is contained in:
@@ -27,7 +27,7 @@ public class ModMailMessage implements Serializable {
|
||||
* The ID of the message which caused this message to be created, either the message containing the command or the message received from the user
|
||||
*/
|
||||
@Id
|
||||
@Column(name = "id")
|
||||
@Column(name = "id", nullable = false)
|
||||
private Long messageId;
|
||||
|
||||
/**
|
||||
@@ -62,18 +62,20 @@ public class ModMailMessage implements Serializable {
|
||||
* true: message was send via command, false: message was send from the user
|
||||
* This is used to decide where to get the message from in case of logging, because the user might delete the message and we do not want to re-parse the command message
|
||||
*/
|
||||
@Column(name = "dm_channel")
|
||||
private Boolean dmChannel;
|
||||
@Builder.Default
|
||||
@Column(name = "dm_channel", nullable = false)
|
||||
private Boolean dmChannel = false;
|
||||
|
||||
/**
|
||||
* Staff only: Whether or not this message meant to be sent anonymous
|
||||
*/
|
||||
@Column(name = "anonymous")
|
||||
private Boolean anonymous;
|
||||
@Builder.Default
|
||||
@Column(name = "anonymous", nullable = false)
|
||||
private Boolean anonymous = false;
|
||||
|
||||
@Column(name = "created")
|
||||
@Column(name = "created", nullable = false, insertable = false, updatable = false)
|
||||
private Instant created;
|
||||
|
||||
@Column(name = "updated")
|
||||
@Column(name = "updated", insertable = false, updatable = false)
|
||||
private Instant updated;
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ public class ModMailRole implements Serializable {
|
||||
* Unique ID of the mod mail role
|
||||
*/
|
||||
@Id
|
||||
@Column(name = "id")
|
||||
@Column(name = "id", nullable = false)
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long modMailRoleId;
|
||||
|
||||
@@ -44,10 +44,10 @@ public class ModMailRole implements Serializable {
|
||||
@JoinColumn(name = "role_id", nullable = false)
|
||||
private ARole role;
|
||||
|
||||
@Column(name = "created")
|
||||
@Column(name = "created", nullable = false, insertable = false, updatable = false)
|
||||
private Instant created;
|
||||
|
||||
@Column(name = "updated")
|
||||
@Column(name = "updated", insertable = false, updatable = false)
|
||||
private Instant updated;
|
||||
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ public class ModMailThread implements Serializable {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Column(name = "id")
|
||||
@Column(name = "id", nullable = false)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
@@ -51,10 +51,10 @@ public class ModMailThread implements Serializable {
|
||||
@JoinColumn(name = "server_id", nullable = false)
|
||||
private AServer server;
|
||||
|
||||
@Column(name = "created")
|
||||
@Column(name = "created", nullable = false, insertable = false, updatable = false)
|
||||
private Instant created;
|
||||
|
||||
@Column(name = "updated")
|
||||
@Column(name = "updated", insertable = false, updatable = false)
|
||||
private Instant updated;
|
||||
|
||||
@Column(name = "closed")
|
||||
|
||||
@@ -5,6 +5,7 @@ import dev.sheldan.abstracto.core.models.database.AUserInAServer;
|
||||
import lombok.*;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.io.Serializable;
|
||||
import java.time.Instant;
|
||||
|
||||
/**
|
||||
@@ -19,11 +20,11 @@ import java.time.Instant;
|
||||
@Getter
|
||||
@Setter
|
||||
@EqualsAndHashCode
|
||||
public class ModMailThreadSubscriber {
|
||||
public class ModMailThreadSubscriber implements Serializable {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Column(name = "id")
|
||||
@Column(name = "id", nullable = false)
|
||||
private Long subscriberId;
|
||||
|
||||
/**
|
||||
@@ -44,10 +45,10 @@ public class ModMailThreadSubscriber {
|
||||
@JoinColumn(name = "mod_mail_thread_id", nullable = false)
|
||||
private ModMailThread threadReference;
|
||||
|
||||
@Column(name = "created")
|
||||
@Column(name = "created", nullable = false, insertable = false, updatable = false)
|
||||
private Instant created;
|
||||
|
||||
@Column(name = "updated")
|
||||
@Column(name = "updated", insertable = false, updatable = false)
|
||||
private Instant updated;
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user