From 3934837c64f81b7bc9ff6068795720bcb53318dd Mon Sep 17 00:00:00 2001 From: ian-readman Date: Fri, 30 Aug 2024 10:30:57 +0100 Subject: [PATCH] PO-722 Remove temporary table --- .../migration/V20240823_236__enforcement_new_column.sql | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/main/resources/db/migration/V20240823_236__enforcement_new_column.sql b/src/main/resources/db/migration/V20240823_236__enforcement_new_column.sql index 172cacc0..482e1659 100644 --- a/src/main/resources/db/migration/V20240823_236__enforcement_new_column.sql +++ b/src/main/resources/db/migration/V20240823_236__enforcement_new_column.sql @@ -11,10 +11,11 @@ * Date Author Version Nature of Change * ---------- -------- -------- --------------------------------------------------------------------------------------------------------- * 23/08/2024 I Readman 1.0 PO-644 Add new column to the ENFORCEMENT table +* 30/08/2024 I Readman 1.1 PO-722 Removed temporary table and replaced with DROP / CREATE * **/ -- Create temporary table to hold enforcement data -CREATE TEMP TABLE enforcements_tmp AS SELECT * FROM enforcements; +CREATE TABLE enforcements_tmp AS SELECT * FROM enforcements; -- Drop columns to maintain column order from data model spreadsheet ALTER TABLE enforcements DROP COLUMN warrant_reference; @@ -49,4 +50,7 @@ UPDATE enforcements e SET warrant_reference = (SELECT warrant_reference FROM enf hearing_date = (SELECT hearing_date FROM enforcements_tmp et WHERE e.enforcement_id = et.enforcement_id), hearing_court_id = (SELECT hearing_court_id FROM enforcements_tmp et WHERE e.enforcement_id = et.enforcement_id), account_type = (SELECT account_type FROM enforcements_tmp et WHERE e.enforcement_id = et.enforcement_id), - posted_by_user_id = (SELECT posted_by_user_id FROM enforcements_tmp et WHERE e.enforcement_id = et.enforcement_id); \ No newline at end of file + posted_by_user_id = (SELECT posted_by_user_id FROM enforcements_tmp et WHERE e.enforcement_id = et.enforcement_id); + +-- Using temporary tables caused issues with Flexible Server +DROP TABLE enforcements_tmp;