Skip to content

Commit

Permalink
PO-387 445 and 451 to add indexes to offences table and new columns t…
Browse files Browse the repository at this point in the history
…o business_units and aliases tables (#429)

Co-authored-by: RustyHMCTS <149379845+RustyHMCTS@users.noreply.github.com>
Co-authored-by: Cade Faulkner <147704481+CadeFaulkner@users.noreply.github.com>
  • Loading branch information
3 people authored Jul 8, 2024
1 parent b03f626 commit 1bcf589
Show file tree
Hide file tree
Showing 4 changed files with 82 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/**
* OPAL Program
*
* MODULE : add_org_name_to_aliases.sql
*
* DESCRIPTION : Add organisation_name column to the ALIASES table so we don't use surname column for organisations.
*
* VERSION HISTORY:
*
* Date Author Version Nature of Change
* ---------- ------- -------- ----------------------------------------------------------------------------------------------------------------------------
* 04/07/2024 A Dennis 1.0 PO-445 Add organisation_name column to the ALIASES table so we don't use surname column for organisations.
*
**/
ALTER TABLE aliases
ADD COLUMN organisation_name varchar(50);

COMMENT ON COLUMN aliases.organisation_name IS 'Alias organisation name';
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/**
* OPAL Program
*
* MODULE : add_welsh_to_business_units.sql
*
* DESCRIPTION : Add welsh_languague column to the BUSINESS_UNITS table so to identify them in the database during data retrieval.
*
* VERSION HISTORY:
*
* Date Author Version Nature of Change
* ---------- ------- -------- ----------------------------------------------------------------------------------------------------------------------------------------
* 04/07/2024 A Dennis 1.0 PO-451 Add welsh_languague column to the BUSINESS_UNITS table so to identify them in the OPAL database. It does not exist in Legacy GoB.
*
**/
ALTER TABLE business_units
ADD COLUMN welsh_language boolean;

COMMENT ON COLUMN business_units.welsh_language IS 'To identify if this is a welsh language business unit in Opal. It does not exist in Legacy GoB';
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/**
* OPAL Program
*
* MODULE : update_welsh_business_units.sql
*
* DESCRIPTION : Update the business_units table to indicate the Welsh business units.
*
* VERSION HISTORY:
*
* Date Author Version Nature of Change
* ---------- ------- -------- ----------------------------------------------------------------------------
* 04/07/2024 A Dennis 1.0 PO-451 Update the business_units table to indicate the Welsh business units.
*
**/

UPDATE business_units
SET welsh_language = TRUE
WHERE business_unit_code = '60'
AND business_unit_type = 'Area';

UPDATE business_units
SET welsh_language = TRUE
WHERE business_unit_code = '61'
AND business_unit_type = 'Area';

UPDATE business_units
SET welsh_language = TRUE
WHERE business_unit_code = '63'
AND business_unit_type = 'Area';
17 changes: 17 additions & 0 deletions src/main/resources/db/migration/V20240704_218__index_offences.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/**
* OPAL Program
*
* MODULE : index_offences.sql
*
* DESCRIPTION : Create indexes on columns in OFFENCES table that will be used in searches.
*
* VERSION HISTORY:
*
* Date Author Version Nature of Change
* ---------- ------- -------- ---------------------------------------------------------------------------------------------------------
* 04/07/2024 A Dennis 1.0 PO-387 Create an index on log_timestamp column in the log_audit_details table.
*
**/
CREATE INDEX IF NOT EXISTS off_cjs_code_idx ON offences(cjs_code);
CREATE INDEX IF NOT EXISTS off_offence_title_idx ON offences(offence_title);
CREATE INDEX IF NOT EXISTS off_offence_oas_idx ON offences(offence_oas);

0 comments on commit 1bcf589

Please sign in to comment.