From 838682998f98259c28e7aaa42093e7d4890d5684 Mon Sep 17 00:00:00 2001 From: Mateusz Konieczny Date: Wed, 5 Oct 2022 17:52:08 +0200 Subject: [PATCH] fix problem with migration it was not caught due to retesting it on already modified database --- migrations/033.redesign_protection_designation.up.sql | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/migrations/033.redesign_protection_designation.up.sql b/migrations/033.redesign_protection_designation.up.sql index b23ad38e..c51d3544 100644 --- a/migrations/033.redesign_protection_designation.up.sql +++ b/migrations/033.redesign_protection_designation.up.sql @@ -6,11 +6,16 @@ SET planning_local_list_url = 'identified as listed: please replace with link' WHERE planning_local_list_url = '' AND planning_in_local_list; +ALTER TABLE buildings ADD COLUMN IF NOT EXISTS planning_in_conservation_area_url VARCHAR DEFAULT ''; +ALTER TABLE buildings ADD COLUMN IF NOT EXISTS planning_in_conservation_area_id VARCHAR DEFAULT ''; + UPDATE buildings SET planning_in_conservation_area_url = 'identified as within conservation area: please replace with link' WHERE planning_in_conservation_area_url = '' AND planning_in_conservation_area; +ALTER TABLE buildings DROP COLUMN IF EXISTS planning_in_conservation_area; + --no need to store both id and link that can be derived from it ALTER TABLE buildings DROP COLUMN IF EXISTS planning_nhle_link; @@ -21,11 +26,6 @@ ALTER TABLE buildings ADD COLUMN IF NOT EXISTS planning_in_apa_url VARCHAR DEFAU ALTER TABLE buildings DROP COLUMN IF EXISTS planning_heritage_at_risk_id; ALTER TABLE buildings ADD COLUMN IF NOT EXISTS planning_heritage_at_risk_url VARCHAR DEFAULT ''; - -ALTER TABLE buildings ADD COLUMN IF NOT EXISTS planning_in_conservation_area_id VARCHAR DEFAULT ''; -ALTER TABLE buildings DROP COLUMN IF EXISTS planning_in_conservation_area; -ALTER TABLE buildings ADD COLUMN IF NOT EXISTS planning_in_conservation_area_url VARCHAR DEFAULT ''; - --fully removed ALTER TABLE buildings DROP COLUMN IF EXISTS planning_in_glher; ALTER TABLE buildings DROP COLUMN IF EXISTS planning_apa_name;