Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
barry-jones50410 authored Feb 6, 2025
1 parent a0f2ae4 commit a2f7a13
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 33 deletions.
Binary file modified src/main/resources/db/reference/modernised_darts_erd.pdf
Binary file not shown.
6 changes: 6 additions & 0 deletions src/main/resources/db/reference/modernised_darts_schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,7 @@
-- remove folder_path from event,media & transcription
-- add production_name to arm_rpo_execution_detail
-- add is_dets to external_object_directory
--v72.5 add storage_id to media, transcription_document, daily_list,annotation_document, object_retrieval_queue

-- List of Table Aliases
-- annotation ANN
Expand Down Expand Up @@ -479,6 +480,7 @@ CREATE TABLE annotation_document
,subcontent_object_id CHARACTER VARYING(16)
,subcontent_position INTEGER
,clip_id CHARACTER VARYING(54)
,storage_id CHARACTER VARYING(16)
,data_ticket INTEGER
,file_name CHARACTER VARYING NOT NULL
,file_type CHARACTER VARYING NOT NULL
Expand Down Expand Up @@ -846,6 +848,7 @@ CREATE TABLE daily_list
,subcontent_object_id CHARACTER VARYING(16)
,subcontent_position INTEGER
,clip_id CHARACTER VARYING
,storage_id CHARACTER VARYING(16)
,data_ticket INTEGER
,external_location UUID
,elt_id INTEGER
Expand Down Expand Up @@ -1224,6 +1227,7 @@ CREATE TABLE media
,subcontent_object_id CHARACTER VARYING(16)
,subcontent_position INTEGER
,clip_id CHARACTER VARYING(54)
,storage_id CHARACTER VARYING(16)
,data_ticket INTEGER
,channel INTEGER NOT NULL -- 1,2,3,4 or rarely 5
,total_channels INTEGER NOT NULL --99.9% are "4" in legacy, occasionally 1,2,5
Expand Down Expand Up @@ -1426,6 +1430,7 @@ CREATE TABLE object_retrieval_queue
,trd_id INTEGER
,parent_object_id CHARACTER VARYING
,content_object_id CHARACTER VARYING
,storage_id CHARACTER VARYING(16)
,clip_id CHARACTER VARYING
,data_ticket INTEGER
,acknowledged_ts TIMESTAMP WITH TIME ZONE
Expand Down Expand Up @@ -1594,6 +1599,7 @@ CREATE TABLE transcription_document
,subcontent_object_id CHARACTER VARYING(16)
,subcontent_position INTEGER
,clip_id CHARACTER VARYING(54)
,storage_id CHARACTER VARYING(16)
,data_ticket INTEGER
,file_name CHARACTER VARYING NOT NULL
,file_type CHARACTER VARYING NOT NULL
Expand Down
41 changes: 29 additions & 12 deletions src/main/resources/db/reference/object_state_record.sql
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,21 @@
--v5 amend tablespace to pg_default
--v6 add revinfo table, as another externally defined object
--v7 add audit_user to revinfo and FK to user_account
--v8 add storage_id and data_ticket to object_state_record
-- add primary key to object_state_record
-- add various indexes to object_state_record
-- remove id_case,courthouse_name,date_last_accessed,flag_file_retained_in_ods from object_state_record
-- remove relation_id,cas_id,parent_id,object_type from object_state_record


CREATE TABLE object_state_record
(osr_uuid BIGINT NOT NULL
,eod_id CHARACTER VARYING
,arm_eod_id CHARACTER VARYING
,parent_id CHARACTER VARYING --
,parent_object_id CHARACTER VARYING --
,content_object_id CHARACTER VARYING --
,object_type CHARACTER VARYING --
,parent_object_id CHARACTER VARYING
,content_object_id CHARACTER VARYING
,id_clip CHARACTER VARYING
,id_case CHARACTER VARYING
,courthouse_name CHARACTER VARYING
,cas_id INTEGER
,date_last_accessed TIMESTAMP WITH TIME ZONE
,relation_id CHARACTER VARYING
,dets_location CHARACTER VARYING --
,dets_location CHARACTER VARYING
,flag_file_transfer_to_dets BOOLEAN
,date_file_transfer_to_dets TIMESTAMP WITH TIME ZONE
,md5_doc_transfer_to_dets CHARACTER VARYING
Expand Down Expand Up @@ -49,10 +47,29 @@ CREATE TABLE object_state_record
,id_response_uf_file CHARACTER VARYING
,flag_file_dets_cleanup_status BOOLEAN
,date_file_dets_cleanup TIMESTAMP WITH TIME ZONE
,flag_file_retained_in_ods BOOLEAN
,object_status CHARACTER VARYING
,storage_id CHARACTER VARYING
,data_ticket INTEGER
) TABLESPACE pg_default;

CREATE UNIQUE INDEX object_state_record_pk ON object_state_record(osr_uuid) TABLESPACE pg_default;
ALTER TABLE object_state_record ADD PRIMARY KEY USING INDEX object_state_record_pk;

-- multicolumn index, as two columns will be referenced together
CREATE INDEX osr_storage_id_data_ticket ON object_state_record(storage_id,data_ticket) TABLESPACE pg_default;

-- only one of the following two indexes should be retained
CREATE INDEX osr_id_clip ON object_state_record(id_clip) TABLESPACE pg_default;
-- if the queries that neccesitate this index remain, remove single column, otherwise retain this one,and remove id_clip.
CREATE INDEX osr_id_clip_md5_doc_tx_dets ON object_state_record(id_clip,md5_doc_transfer_to_dets) TABLESPACE pg_default;

-- obviously if the md5 column is not needed in the 2 column index above, the following would also be redundant
CREATE INDEX osr_md5_doc_tx_dets ON object_state_record(md5_doc_transfer_to_dets) TABLESPACE pg_default;

CREATE INDEX osr_content_object_id ON object_state_record(content_object_id) TABLESPACE pg_default;
CREATE INDEX osr_flag_file_transfer_to_dets ON object_state_record(flag_file_transfer_to_dets) TABLESPACE pg_default;


CREATE TABLE revinfo
(rev INT4 NOT NULL
,revtstmp INT8
Expand All @@ -62,4 +79,4 @@ CREATE TABLE revinfo

ALTER TABLE revinfo
ADD CONSTRAINT revinfo_audit_user_fk
FOREIGN KEY (audit_user) REFERENCES user_account(usr_id);
FOREIGN KEY (audit_user) REFERENCES user_account(usr_id);
23 changes: 2 additions & 21 deletions src/main/resources/db/reference/retention.sql
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
-- v17 replace definition of case_retention_extra
-- add pk to retention_policy_type_heritage_mapping
-- amend manual_retention_override and actual_case_closed_flag to int from bool
--v18 add default to created_ts on case_overflow

SET ROLE DARTS_OWNER;
SET SEARCH_PATH TO darts;
Expand Down Expand Up @@ -194,33 +195,13 @@ CREATE TABLE case_overflow
,end_of_sentence_date_ts TIMESTAMP WITH TIME ZONE
,manual_retention_override INTEGER
,retain_until_ts TIMESTAMP WITH TIME ZONE
--,is_standard_policy BOOLEAN
--,is_permanent_policy BOOLEAN
--,checked_ts TIMESTAMP WITH TIME ZONE
--,corrected_ts TIMESTAMP WITH TIME ZONE
,c_closed_pre_live INTEGER
,c_case_closed_date_pre_live TIMESTAMP WITH TIME ZONE
,case_created_ts TIMESTAMP WITH TIME ZONE
,audio_folder_object_id CHARACTER VARYING(16)
--,case_object_name CHARACTER VARYING(255) -- to accommodate dm_sysobject_s.object_name
--,case_closed_eve_id INTEGER -- unenforced fk to event
--,tol_case_closed_ts TIMESTAMP WITH TIME ZONE
--,tol_case_closed_type CHARACTER VARYING -- enumerated type, not normalised
--,ret_retain_until_ts TIMESTAMP WITH TIME ZONE
--,aud_retain_until_ts TIMESTAMP WITH TIME ZONE
--,migration_type CHARACTER VARYING -- to indicate how we've got to this point with this record
--,migration_error_1 CHARACTER VARYING
--,migration_error_2 CHARACTER VARYING
--,migration_error_3 CHARACTER VARYING
--,migration_error_4 CHARACTER VARYING
--,ret_conf_score INTEGER
--,ret_conf_reason CHARACTER VARYING
--,ret_conf_updated_ts TIMESTAMP WITH TIME ZONE
--,tol_diff_c_close_in_days INTEGER
--,tol_diff_ret_dt_in_days INTEGER
,case_last_modified_ts TIMESTAMP WITH TIME ZONE -- to support delta, when case changed
,audio_last_modified_ts TIMESTAMP WITH TIME ZONE -- to suppor delta, when moj_audio_folder changes
,created_ts TIMESTAMP WITH TIME ZONE NOT NULL
,created_ts TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT current_timestamp
,last_modified_ts TIMESTAMP WITH TIME ZONE NOT NULL
) TABLESPACE pg_default;

Expand Down

0 comments on commit a2f7a13

Please sign in to comment.