From b3d84734db6e87c25a8c25e78962a22e541c9615 Mon Sep 17 00:00:00 2001 From: ian-readman Date: Tue, 9 Jul 2024 11:28:56 +0100 Subject: [PATCH] PO-501 Fix minor issues with the CREATE TABLE scripts --- ...ard_letters_fk_report_entries_not_null.sql | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 src/main/resources/db/migration/V20240709_219__standard_letters_fk_report_entries_not_null.sql diff --git a/src/main/resources/db/migration/V20240709_219__standard_letters_fk_report_entries_not_null.sql b/src/main/resources/db/migration/V20240709_219__standard_letters_fk_report_entries_not_null.sql new file mode 100644 index 000000000..de6c11f1a --- /dev/null +++ b/src/main/resources/db/migration/V20240709_219__standard_letters_fk_report_entries_not_null.sql @@ -0,0 +1,26 @@ +/** +* +* OPAL Program +* +* MODULE : standard_letters_report_entries_fix.sql +* +* DESCRIPTION : Rename constraint for STANDARD_LETTERS and set REPORT_ENTRIES columns to be not null. +* +* VERSION HISTORY: +* +* Date Author Version Nature of Change +* ---------- -------- -------- --------------------------------------------------------------------------------------------------------- +* 09/07/2024 I Readman 1.0 PO-501 Fix minor issues with the CREATE TABLE scripts +* +**/ + +-- Rename Constraint +ALTER TABLE standard_letters RENAME CONSTRAINT ct_business_unit_id_fk TO sl_business_unit_id_fk; + +-- Set columns to NOT NULL +ALTER TABLE report_entries ALTER business_unit_id SET NOT NULL; +ALTER TABLE report_entries ALTER report_id SET NOT NULL; +ALTER TABLE report_entries ALTER entry_timestamp SET NOT NULL; +ALTER TABLE report_entries ALTER reported_timestamp SET NOT NULL; +ALTER TABLE report_entries ALTER associated_record_type SET NOT NULL; +ALTER TABLE report_entries ALTER associated_record_id SET NOT NULL; \ No newline at end of file