mirror of
https://github.com/Sheldan/abstracto.git
synced 2026-04-20 13:26:50 +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:
@@ -51,13 +51,13 @@ public class Mute implements Serializable {
|
||||
/**
|
||||
* The reason of the mute which is stored
|
||||
*/
|
||||
@Column(name = "reason")
|
||||
@Column(name = "reason", nullable = false)
|
||||
private String reason;
|
||||
|
||||
/**
|
||||
* The date when the mute was cast, and the start date
|
||||
*/
|
||||
@Column(name = "mute_date")
|
||||
@Column(name = "mute_date", nullable = false)
|
||||
private Instant muteDate;
|
||||
|
||||
/**
|
||||
@@ -69,8 +69,9 @@ public class Mute implements Serializable {
|
||||
/**
|
||||
* Whether or not the mute already ended, be it manually or when the time passed
|
||||
*/
|
||||
@Column(name = "mute_ended")
|
||||
private Boolean muteEnded;
|
||||
@Builder.Default
|
||||
@Column(name = "mute_ended", nullable = false)
|
||||
private Boolean muteEnded = false;
|
||||
|
||||
/**
|
||||
* The message which contained the command which caused this mute
|
||||
@@ -82,7 +83,7 @@ public class Mute implements Serializable {
|
||||
* The channel in which this mute was cast
|
||||
*/
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "mutingChannel", nullable = false)
|
||||
@JoinColumn(name = "mutingChannel")
|
||||
private AChannel mutingChannel;
|
||||
|
||||
/**
|
||||
@@ -91,7 +92,7 @@ public class Mute implements Serializable {
|
||||
@Column(name = "trigger_key")
|
||||
private String triggerKey;
|
||||
|
||||
@Column(name = "created")
|
||||
@Column(name = "created", nullable = false, insertable = false, updatable = false)
|
||||
private Instant created;
|
||||
|
||||
@PrePersist
|
||||
@@ -99,7 +100,7 @@ public class Mute implements Serializable {
|
||||
this.muteDate = Instant.now();
|
||||
}
|
||||
|
||||
@Column(name = "updated")
|
||||
@Column(name = "updated", insertable = false, updatable = false)
|
||||
private Instant updated;
|
||||
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ public class MuteRole implements Serializable {
|
||||
*/
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Column(name = "id")
|
||||
@Column(name = "id", nullable = false)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
@@ -45,10 +45,10 @@ public class MuteRole 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;
|
||||
|
||||
}
|
||||
|
||||
@@ -31,13 +31,13 @@ public class UserNote implements Serializable {
|
||||
@JoinColumn(name = "user_in_server_id", nullable = false)
|
||||
private AUserInAServer user;
|
||||
|
||||
@Column(length = 2000, name = "note")
|
||||
@Column(length = 2000, name = "note", nullable = false)
|
||||
private String note;
|
||||
|
||||
@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;
|
||||
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ public class Warning implements Serializable {
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@Column(name = "warn_date")
|
||||
@Column(name = "warn_date", nullable = false)
|
||||
private Instant warnDate;
|
||||
|
||||
/**
|
||||
@@ -72,8 +72,9 @@ public class Warning implements Serializable {
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@Column(name = "decayed")
|
||||
private Boolean decayed;
|
||||
@Builder.Default
|
||||
@Column(name = "decayed", nullable = false)
|
||||
private Boolean decayed = false;
|
||||
|
||||
/**
|
||||
* The date at which the warning was decayed
|
||||
@@ -83,10 +84,10 @@ public class Warning implements Serializable {
|
||||
@Column(name = "decay_date")
|
||||
private Instant decayDate;
|
||||
|
||||
@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