[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:
Sheldan
2021-05-23 14:17:03 +02:00
parent 04a7cfafd7
commit 13a6e1fdca
145 changed files with 1204 additions and 350 deletions

View File

@@ -0,0 +1,10 @@
<?xml version="1.1" encoding="UTF-8" standalone="no"?>
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
xmlns:pro="http://www.liquibase.org/xml/ns/pro"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog dbchangelog.xsd
http://www.liquibase.org/xml/ns/dbchangelog-ext dbchangelog.xsd
http://www.liquibase.org/xml/ns/pro dbchangelog.xsd" >
<include file="tables/tables.xml" relativeToChangelogFile="true"/>
</databaseChangeLog>

View File

@@ -0,0 +1,17 @@
<?xml version="1.1" encoding="UTF-8" standalone="no"?>
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
xmlns:pro="http://www.liquibase.org/xml/ns/pro"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog dbchangelog.xsd
http://www.liquibase.org/xml/ns/dbchangelog-ext dbchangelog.xsd
http://www.liquibase.org/xml/ns/pro dbchangelog.xsd" >
<changeSet author="Sheldan" id="reminder-notnull">
<addNotNullConstraint columnName="created"
tableName="reminder"
validate="true"/>
<addNotNullConstraint columnName="target_date"
tableName="reminder"
validate="true"/>
</changeSet>
</databaseChangeLog>

View File

@@ -0,0 +1,10 @@
<?xml version="1.1" encoding="UTF-8" standalone="no"?>
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
xmlns:pro="http://www.liquibase.org/xml/ns/pro"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog dbchangelog.xsd
http://www.liquibase.org/xml/ns/dbchangelog-ext dbchangelog.xsd
http://www.liquibase.org/xml/ns/pro dbchangelog.xsd" >
<include file="reminder.xml" relativeToChangelogFile="true"/>
</databaseChangeLog>

View File

@@ -8,4 +8,5 @@
http://www.liquibase.org/xml/ns/pro dbchangelog.xsd" >
<include file="1.0-remind/collection.xml" relativeToChangelogFile="true"/>
<include file="1.2.10-remind/collection.xml" relativeToChangelogFile="true"/>
<include file="1.2.12/collection.xml" relativeToChangelogFile="true"/>
</databaseChangeLog>

View File

@@ -21,7 +21,7 @@ public class Reminder implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id")
@Column(name = "id", nullable = false)
private Long id;
@ManyToOne(fetch = FetchType.LAZY)
@@ -39,20 +39,21 @@ public class Reminder 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 reminderDate;
@Column(name = "updated")
@Column(name = "updated", insertable = false, updatable = false)
private Instant updated;
@Column(name = "target_date")
@Column(name = "target_date", nullable = false)
private Instant targetDate;
@Column(name = "text")
private String text;
@Column(name = "reminded")
private boolean reminded;
@Builder.Default
@Column(name = "reminded", nullable = false)
private boolean reminded = false;
@Column(name = "job_trigger_key")
private String jobTriggerKey;