From 14bc6e0d91f5e5fb9e548cb861e67c43dc6fb4b6 Mon Sep 17 00:00:00 2001 From: mz8i Date: Wed, 2 Oct 2019 16:47:17 +0100 Subject: [PATCH] Fix/category default values (#451) * Amend sustainability and type migrations * Add DROP TYPE to down migrations --- migrations/011.sustainability.down.sql | 5 +++++ migrations/011.sustainability.up.sql | 2 +- migrations/012.type.down.sql | 2 ++ migrations/012.type.up.sql | 5 ++--- 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/migrations/011.sustainability.down.sql b/migrations/011.sustainability.down.sql index 8cdf14eb..a1279e3e 100644 --- a/migrations/011.sustainability.down.sql +++ b/migrations/011.sustainability.down.sql @@ -26,3 +26,8 @@ ALTER TABLE buildings DROP COLUMN IF EXISTS sust_life_expectancy; --Average lifespan of typology based on statistical analysis of similar stock ALTER TABLE buildings DROP COLUMN IF EXISTS sust_lifespan_average; + + +DROP TYPE IF EXISTS sust_breeam_rating; +DROP TYPE IF EXISTS sust_dec; +DROP TYPE IF EXISTS sust_aggregate_estimate_epc; diff --git a/migrations/011.sustainability.up.sql b/migrations/011.sustainability.up.sql index 854d61f2..500fe728 100644 --- a/migrations/011.sustainability.up.sql +++ b/migrations/011.sustainability.up.sql @@ -14,7 +14,7 @@ AS ENUM ('Outstanding', 'Unclassified'); ALTER TABLE buildings - ADD COLUMN IF NOT EXISTS sust_breeam_rating sust_breeam_rating DEFAULT 'Unclassified'; + ADD COLUMN IF NOT EXISTS sust_breeam_rating sust_breeam_rating; -- Date of BREEAM ALTER TABLE buildings diff --git a/migrations/012.type.down.sql b/migrations/012.type.down.sql index 414d04b0..60578f6f 100644 --- a/migrations/012.type.down.sql +++ b/migrations/012.type.down.sql @@ -4,3 +4,5 @@ ALTER TABLE buildings DROP COLUMN IF EXISTS building_attachment_form; -- [Disabled for launch] Date of change of use -- This needs to pair with demolition ALTER TABLE buildings DROP COLUMN IF EXISTS date_change_building_use; + +DROP TYPE IF EXISTS building_attachment_form; diff --git a/migrations/012.type.up.sql b/migrations/012.type.up.sql index f925dedf..50268408 100644 --- a/migrations/012.type.up.sql +++ b/migrations/012.type.up.sql @@ -3,11 +3,10 @@ CREATE TYPE building_attachment_form AS ENUM ('Detached', 'Semi-Detached', 'End-Terrace', - 'Mid-Terrace', - 'Unknown'); + 'Mid-Terrace'); ALTER TABLE buildings - ADD COLUMN IF NOT EXISTS building_attachment_form building_attachment_form DEFAULT 'Unknown'; + ADD COLUMN IF NOT EXISTS building_attachment_form building_attachment_form; -- [Disabled for launch] Date of change of use -- This needs to pair with demolition