From 80d488dca17c5f3e84b514afe56ef225d1262716 Mon Sep 17 00:00:00 2001 From: abrahamdennis Date: Tue, 20 Aug 2024 09:14:13 +0100 Subject: [PATCH] PO-641 add new column originator_id and remove column originator_reference --- .../opal/entity/DefendantAccountEntity.java | 4 ++-- ...0240820_233__modify_defendant_accounts.sql | 23 +++++++++++++++++++ .../entity/DefendantAccountEntityTest.java | 4 ++-- 3 files changed, 27 insertions(+), 4 deletions(-) create mode 100644 src/main/resources/db/migration/V20240820_233__modify_defendant_accounts.sql diff --git a/src/main/java/uk/gov/hmcts/opal/entity/DefendantAccountEntity.java b/src/main/java/uk/gov/hmcts/opal/entity/DefendantAccountEntity.java index 2cd796432..417b7b98f 100644 --- a/src/main/java/uk/gov/hmcts/opal/entity/DefendantAccountEntity.java +++ b/src/main/java/uk/gov/hmcts/opal/entity/DefendantAccountEntity.java @@ -110,8 +110,8 @@ public class DefendantAccountEntity { @Column(name = "originator_name", length = 100) private String originatorName; - @Column(name = "originator_reference", length = 40) - private String originatorReference; + @Column(name = "originator_id", length = 40) + private String originatorId; @Column(name = "originator_type", length = 10) private String originatorType; diff --git a/src/main/resources/db/migration/V20240820_233__modify_defendant_accounts.sql b/src/main/resources/db/migration/V20240820_233__modify_defendant_accounts.sql new file mode 100644 index 000000000..9055c665a --- /dev/null +++ b/src/main/resources/db/migration/V20240820_233__modify_defendant_accounts.sql @@ -0,0 +1,23 @@ +/** +* +* OPAL Program +* +* MODULE : modify_defendant_accounts.sql +* +* DESCRIPTION : Modified DEFENDANT_ACCOUNTS table to add originator_id column and drop originator_reference column. +* +* VERSION HISTORY: +* +* Date Author Version Nature of Change +* ---------- -------- -------- ---------------------------------------------------------------------------------------------------------- +* 20/08/2024 A Dennis 1.0 PO-641 Modified DEFENDANT_ACCOUNTS table to add originator_id column and drop originator_reference column. +* +**/ + +ALTER TABLE defendant_accounts +DROP COLUMN IF EXISTS originator_reference; + +ALTER TABLE defendant_accounts +ADD COLUMN originator_id varchar(40); + +COMMENT ON COLUMN defendant_accounts.originator_id IS 'ID of the Originator'; diff --git a/src/test/java/uk/gov/hmcts/opal/entity/DefendantAccountEntityTest.java b/src/test/java/uk/gov/hmcts/opal/entity/DefendantAccountEntityTest.java index de2918954..795e16b98 100644 --- a/src/test/java/uk/gov/hmcts/opal/entity/DefendantAccountEntityTest.java +++ b/src/test/java/uk/gov/hmcts/opal/entity/DefendantAccountEntityTest.java @@ -35,7 +35,7 @@ public void testGettersAndSetters() { defendantAccount.setLastEnforcement("123456"); defendantAccount.setLastChangedDate(now); defendantAccount.setOriginatorName("name"); - defendantAccount.setOriginatorReference("reference"); + defendantAccount.setOriginatorId("reference"); defendantAccount.setOriginatorType("type"); defendantAccount.setAllowWriteoffs(true); defendantAccount.setAllowCheques(true); @@ -77,7 +77,7 @@ public void testGettersAndSetters() { assertEquals("123456", defendantAccount.getLastEnforcement()); assertEquals(now, defendantAccount.getLastChangedDate()); assertEquals("name", defendantAccount.getOriginatorName()); - assertEquals("reference", defendantAccount.getOriginatorReference()); + assertEquals("reference", defendantAccount.getOriginatorId()); assertEquals("type", defendantAccount.getOriginatorType()); assertTrue(defendantAccount.isAllowWriteoffs()); assertTrue(defendantAccount.isAllowCheques());