[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

@@ -44,7 +44,7 @@ public class AssignableRole implements Serializable {
@Getter
@Setter
@ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST, CascadeType.MERGE})
@JoinColumn(name = "assignable_role_place_post_id")
@JoinColumn(name = "place_post_id")
private AssignableRolePlacePost assignableRolePlacePost;
@Getter
@@ -54,24 +54,18 @@ public class AssignableRole implements Serializable {
@org.hibernate.annotations.Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
private List<AssignedRoleUser> assignedUsers = new ArrayList<>();
@Column(name = "description")
private String description;
@Column(name = "required_level")
private Integer requiredLevel;
@Column(name = "position")
private Integer position;
@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

@@ -28,6 +28,7 @@ public class AssignableRolePlace implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id")
private Long id;
@OneToOne
@@ -38,9 +39,9 @@ public class AssignableRolePlace implements Serializable {
@JoinColumn(name="server_id")
private AServer server;
@Column(name = "key")
private String key;
@OneToMany(
fetch = FetchType.LAZY,
cascade = {CascadeType.PERSIST, CascadeType.MERGE},
@@ -61,34 +62,29 @@ public class AssignableRolePlace implements Serializable {
@org.hibernate.annotations.Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
private List<AssignableRole> assignableRoles = new ArrayList<>();
@Column(name = "text")
private String text;
@Builder.Default
@Column(name = "active")
private Boolean active = true;
@Builder.Default
@Column(name = "inline")
private Boolean inline = false;
@Builder.Default
@Column(name = "unique_roles")
private Boolean uniqueRoles = false;
@Builder.Default
@Column(name = "auto_remove")
private Boolean autoRemove = false;
@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

@@ -23,6 +23,7 @@ import java.util.List;
public class AssignableRolePlacePost implements Serializable {
@Id
@Column(name = "id")
private Long id;
@ManyToOne
@@ -32,6 +33,9 @@ public class AssignableRolePlacePost implements Serializable {
@Column(name = "created")
private Instant created;
@Column(name = "updated")
private Instant updated;
@ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST, CascadeType.MERGE})
@Getter
@Setter
@@ -46,9 +50,4 @@ public class AssignableRolePlacePost implements Serializable {
@org.hibernate.annotations.Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
private List<AssignableRole> assignableRoles = new ArrayList<>();
@PrePersist
private void onInsert() {
this.created = Instant.now();
}
}

View File

@@ -23,6 +23,7 @@ import java.util.List;
public class AssignedRoleUser implements Serializable {
@Id
@Column(name = "id")
private Long id;
@OneToOne(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST, CascadeType.MERGE})
@@ -38,12 +39,10 @@ public class AssignedRoleUser implements Serializable {
@Builder.Default
private List<AssignableRole> roles = new ArrayList<>();
@Column(name = "created")
private Instant created;
@PrePersist
private void onInsert() {
this.created = Instant.now();
}
@Column(name = "updated")
private Instant updated;
}