[AB-103] adding triggers to update created and updating attributes on tables

fixing error handling in installer
merging change sets to larger operations
adding check constraints
fixing suggestion id handling
applying naming conventions to various columns
adding indices to tables
adding user in server and user locking
This commit is contained in:
Sheldan
2021-02-07 03:06:48 +01:00
parent dac3b0887f
commit 038d5c3832
126 changed files with 1416 additions and 986 deletions

View File

@@ -21,6 +21,7 @@ public class AllowedInviteLink {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id")
private Long id;
@Column(name = "code")
@@ -30,12 +31,10 @@ public class AllowedInviteLink {
@JoinColumn(name = "server_id", nullable = false)
private AServer server;
@Column(name = "created")
private Instant created;
@PrePersist
private void onInsert() {
this.created = Instant.now();
}
@Column(name = "updated")
private Instant updated;
}

View File

@@ -21,6 +21,7 @@ public class FilteredInviteLink {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id")
private Long id;
@Column(name = "code")
@@ -39,16 +40,7 @@ public class FilteredInviteLink {
@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

@@ -41,40 +41,44 @@ public class Mute implements Serializable {
* The {@link AUserInAServer} which was muted
*/
@ManyToOne
@JoinColumn(name = "mutedUser", nullable = false)
@JoinColumn(name = "muted_user_in_server_id", nullable = false)
private AUserInAServer mutedUser;
/**
* The {@link AUserInAServer} which casted the mute
*/
@ManyToOne
@JoinColumn(name = "mutingUser", nullable = false)
@JoinColumn(name = "muting_user_in_server_id", nullable = false)
private AUserInAServer mutingUser;
/**
* The reason of the mute which is stored
*/
@Column(name = "reason")
private String reason;
/**
* The date when the mute was cast, and the start date
*/
@Column(name = "mute_date")
private Instant muteDate;
/**
* The date at which this mute should be removed in the future
*/
@Column(name = "target_date")
private Instant muteTargetDate;
/**
* Whether or not the mute already ended, be it manually or when the time passed
*/
@Column(name = "mute_ended")
private Boolean muteEnded;
/**
* The message which contained the command which caused this mute
*/
@Column
@Column(name = "message_id")
private Long messageId;
/**
@@ -87,6 +91,7 @@ public class Mute implements Serializable {
/**
* When the mute is scheduled to be un-done with quartz, this stores the quartz trigger in order to cancel it, if need be.
*/
@Column(name = "trigger_key")
private String triggerKey;
@Column(name = "created")
@@ -94,16 +99,10 @@ public class Mute implements Serializable {
@PrePersist
private void onInsert() {
this.created = Instant.now();
this.muteDate = Instant.now();
}
@Column(name = "updated")
private Instant updated;
@PreUpdate
private void onUpdate() {
this.updated = Instant.now();
}
}

View File

@@ -29,6 +29,7 @@ public class MuteRole implements Serializable {
*/
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id")
private Long id;
/**
@@ -50,17 +51,7 @@ public class MuteRole implements Serializable {
@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

@@ -31,17 +31,16 @@ public class UserNote implements Serializable {
private AServer server;
@ManyToOne
@JoinColumn(name = "noteUser", nullable = false)
@JoinColumn(name = "user_in_server_id", nullable = false)
private AUserInAServer user;
@Column(length = 2000)
@Column(length = 2000, name = "note")
private String note;
@Column(name = "created")
private Instant created;
@PrePersist
private void onInsert() {
this.created = Instant.now();
}
@Column(name = "updated")
private Instant updated;
}

View File

@@ -42,7 +42,7 @@ public class Warning implements Serializable {
@Getter
@Setter
@ManyToOne
@JoinColumn(name = "warnedUserId", nullable = false)
@JoinColumn(name = "warned_user_in_server_id", nullable = false)
private AUserInAServer warnedUser;
/**
@@ -51,7 +51,7 @@ public class Warning implements Serializable {
@Getter
@Setter
@ManyToOne
@JoinColumn(name = "warningUserId", nullable = false)
@JoinColumn(name = "warning_user_in_server_id", nullable = false)
private AUserInAServer warningUser;
/**
@@ -59,6 +59,7 @@ public class Warning implements Serializable {
*/
@Getter
@Setter
@Column(name = "reason")
private String reason;
/**
@@ -66,6 +67,7 @@ public class Warning implements Serializable {
*/
@Getter
@Setter
@Column(name = "warn_date")
private Instant warnDate;
/**
@@ -73,6 +75,7 @@ public class Warning implements Serializable {
*/
@Getter
@Setter
@Column(name = "decayed")
private Boolean decayed;
/**
@@ -80,22 +83,13 @@ public class Warning implements Serializable {
*/
@Getter
@Setter
@Column(name = "decay_date")
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();
}
}