Skip to content

Commit

Permalink
PO-722 Remove temporary table
Browse files Browse the repository at this point in the history
  • Loading branch information
ian-readman committed Aug 30, 2024
1 parent 58ce4a8 commit 3934837
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
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;

0 comments on commit 3934837

Please sign in to comment.