Refactor evidence table schema by removing unnecessary constraints and improving primary key definition
This commit is contained in:
parent
65675f1466
commit
17fcc4321f
1 changed files with 2 additions and 10 deletions
|
@ -1,8 +1,7 @@
|
||||||
create table evidence
|
create table evidence
|
||||||
(
|
(
|
||||||
uuid varchar(36) default uuid() not null comment 'The Unique Universal Identifier for the evidence record'
|
uuid varchar(36) default uuid() not null comment 'The Unique Universal Identifier index for the evidence'
|
||||||
primary key comment 'The Unique Universal Identifier index for the evidence',
|
primary key,
|
||||||
blacklist varchar(36) null comment 'Optional. If this evidence caused a blacklist, this would be the evidence related to it',
|
|
||||||
entity varchar(36) not null comment 'The UUID of the entity that this evidence is related to',
|
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',
|
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',
|
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',
|
created timestamp default current_timestamp() not null comment 'The timestamp of the evidence',
|
||||||
constraint evidence_uuid_uindex
|
constraint evidence_uuid_uindex
|
||||||
unique (uuid) comment 'The Unique Universal Identifier index for the evidence',
|
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
|
constraint evidence_entities_uuid_fk
|
||||||
foreign key (entity) references entities (uuid)
|
foreign key (entity) references entities (uuid)
|
||||||
on update cascade on delete cascade,
|
on update cascade on delete cascade,
|
||||||
|
@ -23,10 +19,6 @@ create table evidence
|
||||||
)
|
)
|
||||||
comment 'Table for housing evidence';
|
comment 'Table for housing evidence';
|
||||||
|
|
||||||
create index evidence_blacklist_index
|
|
||||||
on evidence (blacklist)
|
|
||||||
comment 'The Blacklist UUID index';
|
|
||||||
|
|
||||||
create index evidence_entity_index
|
create index evidence_entity_index
|
||||||
on evidence (entity)
|
on evidence (entity)
|
||||||
comment 'The index of the entity UUID';
|
comment 'The index of the entity UUID';
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue