generated from hmcts/spring-boot-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PO-305 added the reference data load for local justice areas.
- Loading branch information
1 parent
c08be18
commit 1a489de
Showing
7 changed files
with
307 additions
and
0 deletions.
There are no files selected for viewing
33 changes: 33 additions & 0 deletions
33
src/main/resources/db/migration/V20240505_140__modify_local_justice_areas.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/** | ||
* OPAL Program | ||
* | ||
* MODULE : modify_local_justice_areas.sql | ||
* | ||
* DESCRIPTION : Modify the LOCAL_JUSTICE_AREAS table in order to be able to load Reference Data from data held in Excel spreadsheet. | ||
* | ||
* VERSION HISTORY: | ||
* | ||
* Date Author Version Nature of Change | ||
* ---------- ------- -------- --------------------------------------------------------------------------------------------------------------------------- | ||
* 05/05/2024 A Dennis 1.0 PO-305 Modify the LOCAL_JUSTICE_AREAS table in order to be able to load Reference Data from data held in Excel spreadsheet. | ||
* | ||
**/ | ||
ALTER TABLE local_justice_areas | ||
ADD COLUMN lja_code varchar(4), | ||
ADD COLUMN address_line_4 varchar(35), | ||
ADD COLUMN address_line_5 varchar(35), | ||
ADD COLUMN end_date timestamp; | ||
|
||
COMMENT ON COLUMN local_justice_areas.lja_code IS 'LJA Code'; | ||
COMMENT ON COLUMN local_justice_areas.address_line_4 IS 'LJA Address line 4'; | ||
COMMENT ON COLUMN local_justice_areas.address_line_5 IS 'LJA Address line 5'; | ||
COMMENT ON COLUMN local_justice_areas.end_date IS 'The end date of the record'; | ||
|
||
ALTER TABLE local_justice_areas | ||
ALTER COLUMN name TYPE varchar(100); | ||
|
||
ALTER TABLE account_transfers | ||
DROP constraint IF EXISTS at_local_justice_area_id_fk; | ||
|
||
ALTER TABLE defendant_accounts | ||
DROP constraint IF EXISTS res_enf_override_tfo_lja_id_fk; |
16 changes: 16 additions & 0 deletions
16
src/main/resources/db/migration/V20240505_141__truncate_local_justice_areas.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/** | ||
* OPAL Program | ||
* | ||
* MODULE : modify_local_justice_areas.sql | ||
* | ||
* DESCRIPTION : Truncate the LOCAL_JUSTICE_AREAS table in order to be able to load Reference Data from data held in Excel spreadsheet. | ||
* | ||
* VERSION HISTORY: | ||
* | ||
* Date Author Version Nature of Change | ||
* ---------- ------- -------- --------------------------------------------------------------------------------------------------------------------------- | ||
* 05/05/2024 A Dennis 1.0 PO-305 Truncate the LOCAL_JUSTICE_AREAS table in order to be able to load Reference Data from data held in Excel spreadsheet. | ||
* | ||
**/ | ||
|
||
TRUNCATE TABLE local_justice_areas; |
94 changes: 94 additions & 0 deletions
94
src/main/resources/db/migration/V20240505_142__exported_lja_inserts.sql
Large diffs are not rendered by default.
Oops, something went wrong.
52 changes: 52 additions & 0 deletions
52
src/main/resources/db/migration/V20240505_143__update_account_tranfers.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/** | ||
* OPAL Program | ||
* | ||
* MODULE : update_account_transfers.sql | ||
* | ||
* DESCRIPTION : Update rows of test data in the ACCOUNT_TRANSFERS table after the Local Justice Areas reference data load from spreadsheets to match them to new parent data. | ||
* | ||
* VERSION HISTORY: | ||
* | ||
* Date Author Version Nature of Change | ||
* ---------- ------- -------- -------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ||
* 05/05/2024 A Dennis 1.0 PO-305 Update rows of test data in the ACCOUNT_TRANSFERS table after the Local Justice Areas reference data load from spreadsheets to match them to new parent data. | ||
**/ | ||
UPDATE account_transfers | ||
SET destination_lja_id = 1814 | ||
WHERE destination_lja_id = 2022; | ||
|
||
UPDATE account_transfers | ||
SET destination_lja_id = 2052 | ||
WHERE destination_lja_id = 2216; | ||
|
||
UPDATE account_transfers | ||
SET destination_lja_id = 2126 | ||
WHERE destination_lja_id = 2232; | ||
|
||
UPDATE account_transfers | ||
SET destination_lja_id = 2530 | ||
WHERE destination_lja_id = 2651; | ||
|
||
UPDATE account_transfers | ||
SET destination_lja_id = 2540 | ||
WHERE destination_lja_id = 2078; | ||
|
||
UPDATE account_transfers | ||
SET destination_lja_id = 2619 | ||
WHERE destination_lja_id = 1755; | ||
|
||
UPDATE account_transfers | ||
SET destination_lja_id = 3098 | ||
WHERE destination_lja_id = 2320; | ||
|
||
UPDATE account_transfers | ||
SET destination_lja_id = 3119 | ||
WHERE destination_lja_id = 2160; | ||
|
||
UPDATE account_transfers | ||
SET destination_lja_id = 3123 | ||
WHERE destination_lja_id = 3119; | ||
|
||
UPDATE account_transfers | ||
SET destination_lja_id = 3190 | ||
WHERE destination_lja_id = 2831; |
52 changes: 52 additions & 0 deletions
52
src/main/resources/db/migration/V20240505_144__update_defendant_accounts.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/** | ||
* OPAL Program | ||
* | ||
* MODULE : update_account_transfers.sql | ||
* | ||
* DESCRIPTION : Update rows of test data in the DEFENDANT_ACCOUNTS table after the Local Justice Areas reference data load from spreadsheets to match them to new parent data. | ||
* | ||
* VERSION HISTORY: | ||
* | ||
* Date Author Version Nature of Change | ||
* ---------- ------- -------- -------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ||
* 05/05/2024 A Dennis 1.0 PO-305 Update rows of test data in the DEFENDANT_ACCOUNTS table after the Local Justice Areas reference data load from spreadsheets to match them to new parent data. | ||
**/ | ||
UPDATE defendant_accounts | ||
SET enf_override_tfo_lja_id = 1814 | ||
WHERE enf_override_tfo_lja_id = 2022; | ||
|
||
UPDATE defendant_accounts | ||
SET enf_override_tfo_lja_id = 2052 | ||
WHERE enf_override_tfo_lja_id = 2216; | ||
|
||
UPDATE defendant_accounts | ||
SET enf_override_tfo_lja_id = 2126 | ||
WHERE enf_override_tfo_lja_id = 2232; | ||
|
||
UPDATE defendant_accounts | ||
SET enf_override_tfo_lja_id = 2530 | ||
WHERE enf_override_tfo_lja_id = 2651; | ||
|
||
UPDATE defendant_accounts | ||
SET enf_override_tfo_lja_id = 2540 | ||
WHERE enf_override_tfo_lja_id = 2078; | ||
|
||
UPDATE defendant_accounts | ||
SET enf_override_tfo_lja_id = 2619 | ||
WHERE enf_override_tfo_lja_id = 1755; | ||
|
||
UPDATE defendant_accounts | ||
SET enf_override_tfo_lja_id = 3098 | ||
WHERE enf_override_tfo_lja_id = 2320; | ||
|
||
UPDATE defendant_accounts | ||
SET enf_override_tfo_lja_id = 3119 | ||
WHERE enf_override_tfo_lja_id = 2160; | ||
|
||
UPDATE defendant_accounts | ||
SET enf_override_tfo_lja_id = 3123 | ||
WHERE enf_override_tfo_lja_id = 3119; | ||
|
||
UPDATE defendant_accounts | ||
SET enf_override_tfo_lja_id = 3190 | ||
WHERE enf_override_tfo_lja_id = 2831; |
34 changes: 34 additions & 0 deletions
34
src/main/resources/db/migration/V20240505_145__enable_tables_lja_fks.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/** | ||
* CGI OPAL Program | ||
* | ||
* MODULE : enable_tables_lja_fks.sql | ||
* | ||
* DESCRIPTION : Enable local justice areas foreign keys in tables that had them dropped in order to load LJA reference data for the Fines model | ||
* | ||
* VERSION HISTORY: | ||
* | ||
* Date Author Version Nature of Change | ||
* ---------- ------- -------- -------------------------------------------------------------------------------------------------------------------------------------- | ||
* 05/05/2024 A Dennis 1.0 PO-305 Enable local justice areas foreign keys in tables that had them dropped in order to load LJA reference data for the Fines model | ||
* | ||
**/ | ||
|
||
ALTER TABLE account_transfers | ||
ADD CONSTRAINT at_destination_lja_id_fk FOREIGN KEY | ||
( | ||
destination_lja_id | ||
) | ||
REFERENCES local_justice_areas | ||
( | ||
local_justice_area_id | ||
); | ||
|
||
ALTER TABLE defendant_accounts | ||
ADD CONSTRAINT da_enf_override_tfo_lja_id_fk FOREIGN KEY | ||
( | ||
enf_override_tfo_lja_id | ||
) | ||
REFERENCES local_justice_areas | ||
( | ||
local_justice_area_id | ||
); |
26 changes: 26 additions & 0 deletions
26
src/main/resources/db/migration/V20240507_146__modify_tables_columns_1.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/** | ||
* OPAL Program | ||
* | ||
* MODULE : modify_tables_columns_1.sql | ||
* | ||
* DESCRIPTION : The columns in this script are being modified due to typos in the data model spreadsheet for the Fines model. Included under this Jira ticket for ease. | ||
* | ||
* VERSION HISTORY: | ||
* | ||
* Date Author Version Nature of Change | ||
* ---------- ------- -------- -------------------------------------------------------------------------------------------------------------------------------------------------------------- | ||
* 07/05/2024 A Dennis 1.0 PO-305 The columns in this script are being modified due to typos in the data model spreadsheet for the Fines model. Included under this Jira ticket for ease. | ||
* | ||
**/ | ||
|
||
ALTER TABLE enforcements | ||
ALTER COLUMN result_id TYPE varchar(6); | ||
|
||
ALTER TABLE impositions | ||
ALTER COLUMN posted_by_user_id DROP NOT NULL; | ||
|
||
ALTER TABLE creditor_transactions | ||
ALTER COLUMN posted_by_user_id DROP NOT NULL; | ||
|
||
ALTER TABLE suspense_transactions | ||
ALTER COLUMN posted_by_user_id DROP NOT NULL; |