From 17fcc4321f163e37a4e121eb856680a7e437a051 Mon Sep 17 00:00:00 2001 From: netkas Date: Thu, 5 Jun 2025 00:38:08 -0400 Subject: [PATCH] Refactor evidence table schema by removing unnecessary constraints and improving primary key definition --- src/FederationServer/Classes/Resources/evidence.sql | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/src/FederationServer/Classes/Resources/evidence.sql b/src/FederationServer/Classes/Resources/evidence.sql index 9292db5..32030fa 100644 --- a/src/FederationServer/Classes/Resources/evidence.sql +++ b/src/FederationServer/Classes/Resources/evidence.sql @@ -1,8 +1,7 @@ create table evidence ( - uuid varchar(36) default uuid() not null comment 'The Unique Universal Identifier for the evidence record' - primary key comment 'The Unique Universal Identifier index for the evidence', - blacklist varchar(36) null comment 'Optional. If this evidence caused a blacklist, this would be the evidence related to it', + uuid varchar(36) default uuid() not null comment 'The Unique Universal Identifier index for the evidence' + primary key, entity varchar(36) not null comment 'The UUID of the entity that this evidence is related to', operator varchar(36) not null comment 'The operator that submitted the evidence', confidential tinyint(1) default 0 not null comment 'Default: 0, 1=The evidence and all of it''s attachments is confidential and only operators can view this, 0=The evidence is available for public view', @@ -11,9 +10,6 @@ create table evidence created timestamp default current_timestamp() not null comment 'The timestamp of the evidence', constraint evidence_uuid_uindex unique (uuid) comment 'The Unique Universal Identifier index for the evidence', - constraint evidence_blacklist_uuid_fk - foreign key (blacklist) references blacklist (uuid) - on update cascade on delete set null, constraint evidence_entities_uuid_fk foreign key (entity) references entities (uuid) on update cascade on delete cascade, @@ -23,10 +19,6 @@ create table evidence ) comment 'Table for housing evidence'; -create index evidence_blacklist_index - on evidence (blacklist) - comment 'The Blacklist UUID index'; - create index evidence_entity_index on evidence (entity) comment 'The index of the entity UUID';