From 57221040a3c3a2d4ca44697f89ede2c2945f385b Mon Sep 17 00:00:00 2001 From: SujitMBRDI Date: Tue, 4 Jul 2023 11:25:34 +0530 Subject: [PATCH] fix(gate):fixed the persistence of legalForm --- .../org/eclipse/tractusx/bpdm/gate/entity/LegalEntity.kt | 4 ++-- .../db/migration/V4_0_0_6__make_legal_form_id_optional.sql | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) create mode 100644 bpdm-gate/src/main/resources/db/migration/V4_0_0_6__make_legal_form_id_optional.sql diff --git a/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/entity/LegalEntity.kt b/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/entity/LegalEntity.kt index d3d69858c..25da82ab4 100644 --- a/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/entity/LegalEntity.kt +++ b/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/entity/LegalEntity.kt @@ -38,8 +38,8 @@ class LegalEntity( @Column(name = "name_shortname") var shortName: String?, - @Column(name = "legal_form_id", nullable = false) - var legalForm: String?, + @Column(name = "legal_form_id") + var legalForm: String? = null, @Column(name = "data_type") @Enumerated(EnumType.STRING) diff --git a/bpdm-gate/src/main/resources/db/migration/V4_0_0_6__make_legal_form_id_optional.sql b/bpdm-gate/src/main/resources/db/migration/V4_0_0_6__make_legal_form_id_optional.sql new file mode 100644 index 000000000..ba1b527e5 --- /dev/null +++ b/bpdm-gate/src/main/resources/db/migration/V4_0_0_6__make_legal_form_id_optional.sql @@ -0,0 +1,3 @@ +-- Description: Make 'legal_form_id' column optional in the 'legal_entities' table +-- Alter the 'legal_form_id' column to allow NULL values +ALTER TABLE legal_entities ALTER COLUMN legal_form_id DROP NOT NULL;