[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

@@ -9,10 +9,10 @@
<changeSet author="Sheldan" id="posted_image-table">
<createTable tableName="posted_image">
<column name="message_id" type="BIGINT" >
<constraints nullable="true"/>
<constraints nullable="false"/>
</column>
<column name="position" type="INTEGER" >
<constraints nullable="true"/>
<constraints nullable="false"/>
</column>
<column name="author_user_in_server_id" type="BIGINT">
<constraints nullable="false"/>
@@ -27,7 +27,7 @@
<constraints nullable="false"/>
</column>
<column name="created" type="TIMESTAMP WITHOUT TIME ZONE">
<constraints nullable="true"/>
<constraints nullable="false"/>
</column>
<column name="updated" type="TIMESTAMP WITHOUT TIME ZONE"/>
</createTable>

View File

@@ -9,10 +9,10 @@
<changeSet author="Sheldan" id="repost-table">
<createTable tableName="repost">
<column name="message_id" type="BIGINT" >
<constraints nullable="true"/>
<constraints nullable="false"/>
</column>
<column name="position" type="INTEGER" >
<constraints nullable="true"/>
<constraints nullable="false"/>
</column>
<column name="user_in_server_id" type="BIGINT">
<constraints nullable="false"/>
@@ -24,7 +24,7 @@
<constraints nullable="false"/>
</column>
<column name="created" type="TIMESTAMP WITHOUT TIME ZONE">
<constraints nullable="true"/>
<constraints nullable="false"/>
</column>
<column name="updated" type="TIMESTAMP WITHOUT TIME ZONE"/>
</createTable>

View File

@@ -9,14 +9,14 @@
<changeSet author="Sheldan" id="repost_check_channel_group-table">
<createTable tableName="repost_check_channel_group">
<column name="id" type="BIGINT">
<constraints nullable="true"/>
<constraints nullable="false"/>
</column>
<column name="created" type="TIMESTAMP WITHOUT TIME ZONE">
<constraints nullable="true"/>
<constraints nullable="false"/>
</column>
<column name="updated" type="TIMESTAMP WITHOUT TIME ZONE"/>
<column name="enabled" type="BOOLEAN">
<constraints nullable="true"/>
<constraints nullable="false"/>
</column>
</createTable>
<addForeignKeyConstraint baseColumnNames="id" baseTableName="repost_check_channel_group" constraintName="fk_repost_check_channel_group_group"

View File

@@ -40,13 +40,13 @@ public class PostedImage {
@Setter
private PostIdentifier postId;
@Column(name = "image_hash")
@Column(name = "image_hash", nullable = false)
private String imageHash;
@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;
@Getter

View File

@@ -45,10 +45,10 @@ public class Repost {
})
private PostedImage originalPost;
@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;
}

View File

@@ -24,13 +24,14 @@ public class RepostCheckChannelGroup {
@PrimaryKeyJoinColumn
private AChannelGroup channelGroup;
@Column(name = "enabled")
private Boolean checkEnabled;
@Builder.Default
@Column(name = "enabled", nullable = false)
private Boolean checkEnabled = true;
@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;
}