Ready for staging, tested on local for #405

This commit is contained in:
dominijk 2020-02-27 16:19:52 +00:00
parent 5ca6a6f7fe
commit 6dfc82a397
2 changed files with 72 additions and 10 deletions

View File

@ -1,39 +1,35 @@
-- Remove sustainability fields, update in paralell with adding new fields
-- Last significant retrofit date YYYY
-- Need to add a constraint to sust_retrofit_date
-- Renewal technologies
-- Constraint - Front end multi select back end ENUM
-- Values:
ALTER TABLE buildings DROP COLUMN IF EXISTS sust_renewables_tech;
--Has a building had a major renovation without extenstion (captured in form)
--Boolean yes/no - links to the the DATE
ALTER TABLE buildings DROP COLUMN IF EXISTS sust_retrofitted;
-- Generating capacity of those renewables, on selection of one of the above generate correspondening front end input for this. Pair values
-- Constraint more than 0 less than?, integer only
ALTER TABLE buildings DROP COLUMN IF EXISTS sust_renewables_capax;
-- Biodiversity
-- Green roof, green wall, both
-- Constrain drop down and enum
ALTER TABLE buildings DROP COLUMN IF EXISTS sust_biodiversity;
-- Insulation, tool tip for glazing in construction to cross link
-- Which components are insulated
-- Cosntraint multi-entry and ENUM stored in josnb object
-- Values; Wall, Roof, Floor
-- Values; Wall, Roof, FLOOR
ALTER TABLE buildings DROP COLUMN IF EXISTS constrctn_insulation;
-- Water recycling
-- yes / no
ALTER TABLE buildings DROP COLUMN IF EXISTS sust_h2o_recyling;
-- Rain water harvesting
-- Does builing store it's rainwater
-- Does building store it's rainwater, helps combat flood risk
-- yes / no
ALTER TABLE buildings DROP COLUMN IF EXISTS sust_h2o_harvest;
ALTER TABLE buildings DROP COLUMN IF EXISTS sust_rainwater_harvest;

View File

@ -0,0 +1,66 @@
-- Remove sustainability fields, update in paralell with adding new fields
-- Last significant retrofit date YYYY
-- Need to add a constraint to sust_retrofit_date
ALTER TABLE buildings
ADD CONSTRAINT sust_retrofit_date_end CHECK (sust_retrofit_date <= DATE_PART('year', CURRENT_DATE));
--Has a building had a major renovation without extenstion (captured in form)
--Boolean yes/no - links to the the DATE
ALTER TABLE buildings
ADD COLUMN IF NOT EXISTS sust_retrofitted boolean DEFAULT 'n';
-- Renewal technologies
-- Constraint - Front end multi select back end ENUM
-- Values: Solar PV, Solar thermal, Wind, Ground sourced heat pump, Air sourced heat pump,
CREATE TYPE sust_renewables_tech
AS ENUM ('Solar photovoltaic',
'Solar thermal',
'Wind',
'Ground source heat pump',
'Air-source heat pump',
'Water source heat pump',
'Anaerobic digester');
ALTER TABLE buildings
ADD COLUMN IF NOT EXISTS sust_renewables_tech sust_renewables_tech DEFAULT NULL;
-- Generating capacity of those renewables, on selection of one of the above generate correspondening front end input for this. Pair values
-- Constraint more than 0 less than 9999
ALTER TABLE buildings
ADD COLUMN IF NOT EXISTS sust_renewables_capax int CONSTRAINT high_renewables_capx CHECK (sust_renewables_capax >= 0);
-- Biodiversity
-- Green roof, green wall, both
-- Constrain drop down and enum
CREATE TYPE sust_biodiversity
AS ENUM ('Green roof',
'Green wall',
'Green wall & roof',
'Anaerobic digester');
ALTER TABLE buildings
ADD COLUMN IF NOT EXISTS sust_biodiversity sust_biodiversity DEFAULT NULL;
-- Insulation, tool tip for glazing in construction to cross link
-- Which components are insulated
-- Cosntraint multi-entry and ENUM stored in josnb object
-- Values; Wall, Roof, FLOOR
CREATE TYPE constrctn_insulation
AS ENUM ('Cavity wall',
'External wall',
'Roof',
'Floor');
ALTER TABLE buildings
ADD COLUMN IF NOT EXISTS constrctn_insulation constrctn_insulation DEFAULT NULL;
-- Water recycling
-- yes / no
ALTER TABLE buildings
ADD COLUMN IF NOT EXISTS sust_h2o_recyling boolean DEFAULT 'n';
-- Rain water harvesting
-- Does building store it's rainwater, helps combat flood risk
-- yes / no
ALTER TABLE buildings
ADD COLUMN IF NOT EXISTS sust_rainwater_harvest boolean DEFAULT 'n';