diff --git a/app/src/tiles/dataDefinition.ts b/app/src/tiles/dataDefinition.ts index e63d82ec..841dddce 100644 --- a/app/src/tiles/dataDefinition.ts +++ b/app/src/tiles/dataDefinition.ts @@ -57,13 +57,13 @@ const BUILDING_LAYER_DEFINITIONS = { ) as size_height`, construction_core_material: `( SELECT - b.core_materials, + b.construction_core_material::text as construction_core_material, g.geometry_geom FROM geometries as g, buildings as b WHERE g.geometry_id = b.geometry_id - ) as core_materials`, + ) as construction_core_material`, location: `( SELECT ( @@ -116,7 +116,7 @@ const BUILDING_LAYER_DEFINITIONS = { b.planning_in_conservation_area OR b.planning_in_local_list OR b.planning_list_cat is not null - ) as planning_combined`, + ) as planning_combined`, conservation_area: `( SELECT g.geometry_geom diff --git a/migrations/017.construction-materials.down.sql b/migrations/017.construction-materials.down.sql new file mode 100644 index 00000000..9fba8144 --- /dev/null +++ b/migrations/017.construction-materials.down.sql @@ -0,0 +1,12 @@ +-- Primary material (brick/clay tile, slate, steel/metal, timber, stone, glass, concrete, +-- natural-green or thatch, asphalt or other) +ALTER TABLE buildings DROP COLUMN IF EXISTS construction_core_material; + +--Secondary material +ALTER TABLE buildings DROP COLUMN IF EXISTS construction_secondary_materials; + +--Primary roof material +ALTER TABLE buildings DROP COLUMN IF EXISTS construction_roof_covering; + +DROP TYPE IF EXISTS construction_materials; +DROP TYPE IF EXISTS roof_covering; diff --git a/migrations/017.construction-materials.up.sql b/migrations/017.construction-materials.up.sql new file mode 100644 index 00000000..572cacae --- /dev/null +++ b/migrations/017.construction-materials.up.sql @@ -0,0 +1,42 @@ +-- Launch of Constuction category +-- Fields: Core construction material, Secondary construction materials, Roof covering materials + +-- Construction materials: Wood, Stone, Brick, Steel, Reinforced Concrete, Other Metal +-- Other Natural Material, Other Man-Made Material +CREATE TYPE construction_materials + AS ENUM ( + 'Wood', + 'Stone', + 'Brick', + 'Steel', + 'Reinforced Concrete', + 'Other Metal', + 'Other Natural Material', + 'Other Man-Made Material' + ); + +-- Roof covering materials: Slate, Clay Tile, Wood, Asphalt, Iron or Steel, Other Metal +-- Other Natural Material, Other Man-Made Material +CREATE TYPE roof_covering + AS ENUM ( + 'Slate', + 'Clay Tile', + 'Wood', + 'Asphalt', + 'Iron or Steel', + 'Other Metal', + 'Other Natural Material', + 'Other Man-Made Material' + ); + +-- Core Construction Material +ALTER TABLE buildings + ADD COLUMN IF NOT EXISTS construction_core_material construction_materials; + +-- Secondary Construction Materials +ALTER TABLE buildings + ADD COLUMN IF NOT EXISTS construction_secondary_materials construction_materials; + +-- Main Roof Covering +ALTER TABLE buildings + ADD COLUMN IF NOT EXISTS construction_roof_covering roof_covering; diff --git a/migrations/0xx.construction-materials.down.sql b/migrations/0xx.construction-materials.down.sql deleted file mode 100644 index 74a6f51d..00000000 --- a/migrations/0xx.construction-materials.down.sql +++ /dev/null @@ -1,8 +0,0 @@ - -ALTER TABLE buildings DROP COLUMN IF EXISTS core_materials; -ALTER TABLE buildings DROP COLUMN IF EXISTS secondary_materials; -ALTER TABLE buildings DROP COLUMN IF EXISTS roof_covering; - - -DROP TYPE IF EXISTS construction_materials; -DROP TYPE IF EXISTS roof_covering; \ No newline at end of file diff --git a/migrations/0xx.construction-materials.up.sql b/migrations/0xx.construction-materials.up.sql deleted file mode 100644 index f10eca90..00000000 --- a/migrations/0xx.construction-materials.up.sql +++ /dev/null @@ -1,38 +0,0 @@ --- Launch of Constuction category --- Fields: Core construction material, Secondary construction materials, Roof covering materials - --- Construction materials: Wood, Stone, Brick, Steel, Reinforced Concrete, Other Metal --- Other Natural Material, Other Man-Made Material -CREATE TYPE construction_materials - AS ENUM ('Wood', - 'Stone', - 'Brick', - 'Steel', - 'Reinforced Concrete', - 'Other Metal', - 'Other Natural Material', - 'Other Man-Made Material'); - --- Roof covering materials: Slate, Clay Tile, Wood, Asphalt, Iron or Steel, Other Metal --- Other Natural Material, Other Man-Made Material -CREATE TYPE roof_covering - AS ENUM ('Slate', - 'Clay Tile', - 'Wood', - 'Asphalt', - 'Iron or Steel', - 'Other Metal', - 'Other Natural Material', - 'Other Man-Made Material'); - --- Core Construction Material -ALTER TABLE buildings - ADD COLUMN IF NOT EXISTS core_materials construction_materials; - --- Secondary Construction Materials -ALTER TABLE buildings - ADD COLUMN IF NOT EXISTS secondary_materials construction_materials; - --- Main Roof Covering -ALTER TABLE buildings - ADD COLUMN IF NOT EXISTS roof_covering roof_covering; diff --git a/migrations/0xx.construction.down.sql b/migrations/0xx.construction.down.sql deleted file mode 100644 index adee9941..00000000 --- a/migrations/0xx.construction.down.sql +++ /dev/null @@ -1,23 +0,0 @@ ---NOTE Some construction category fields (insulation and glazing) are migrated in sustainability.up.1-extra see #405 ---Primary material (brick/clay tile, slate, steel/metal, timber, stone, glass, concrete, natural-green or thatch, asphalt or other) -ALTER TABLE buildings DROP COLUMN IF EXISTS constrctn_primary_mat; - ---Secondary material -ALTER TABLE buildings DROP COLUMN IF EXISTS constrctn_secondary_mat; - ---Primary roof material -ALTER TABLE buildings DROP COLUMN IF EXISTS constrctn_primary_roof_mat; - ---Secondary roof material -ALTER TABLE buildings DROP COLUMN IF EXISTS constrctn_secondary_roof_mat; - ---Has building been extended y/n -ALTER TABLE buildings DROP COLUMN IF EXISTS constrctn_extension; - ---What kind of extensions (side, rear, loft, basement) -ALTER TABLE buildings DROP COLUMN IF EXISTS constrctn_extension_type; - ---Glazing type, what is most common glazing type. (unless I add into sustainability for now) -ALTER TABLE buildings DROP COLUMN IF EXISTS constrctn_glazing_type; - ---Also pick up roof in this for