Skip to content

Commit

Permalink
PO-303 loaded the offences reference data from an Excal spreadsheet i…
Browse files Browse the repository at this point in the history
…nto the database table
  • Loading branch information
abrahamdennis authored and RustyHMCTS committed Apr 29, 2024
1 parent 7039d34 commit 855e472
Show file tree
Hide file tree
Showing 2 changed files with 18,261 additions and 0 deletions.
42 changes: 42 additions & 0 deletions src/main/resources/db/migration/V20240425_138__modify_offences.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/**
* OPAL Program
*
* MODULE : modify_offences.sql
*
* DESCRIPTION : Modify the OFFENCES table in order to be able to load Reference Data from data held in Excel spreadsheet.
*
* VERSION HISTORY:
*
* Date Author Version Nature of Change
* ---------- ------- -------- ---------------------------------------------------------------------------------------------------------------
* 25/04/2024 A Dennis 1.0 PO-303 Modify the OFFENCES table in order to be able to load Reference Data from data held in Excel spreadsheet
*
**/
ALTER TABLE offences
ADD COLUMN date_used_to timestamp,
ADD COLUMN offence_oas text,
ADD COLUMN offence_oas_cy text;

ALTER TABLE offences
ALTER COLUMN offence_id TYPE bigint
USING offence_id::bigint;

ALTER TABLE IF EXISTS offences
DROP constraint IF EXISTS off_business_unit_id_fk;

ALTER TABLE offences
ALTER COLUMN business_unit_id DROP NOT NULL;

ALTER TABLE offences
ALTER COLUMN offence_title DROP NOT NULL;

ALTER TABLE offences
ALTER COLUMN offence_title_cy DROP NOT NULL;

ALTER TABLE impositions
ALTER COLUMN offence_id TYPE bigint
USING offence_id::bigint;

COMMENT ON COLUMN offences.date_used_to IS 'The date the offence was in use till. Null of a date in the future means still in use';
COMMENT ON COLUMN offences.offence_oas IS 'The English Offence Act and Section/Legislation';
COMMENT ON COLUMN offences.offence_oas_cy IS 'The Welsh Offence Act and Section/Legislation';
Loading

0 comments on commit 855e472

Please sign in to comment.