Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PO-722 Remove temporary table #515

Merged
merged 1 commit into from
Aug 30, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;