Rename construction migration to 017, fix tile definition

Note that enum types need to be cast to ::text for mapnik
rules to work as expected.
This commit is contained in:
Tom Russell 2020-04-17 17:01:21 +01:00
parent c20ea2bbb0
commit d1c42a40a6
6 changed files with 57 additions and 72 deletions

View File

@ -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
(

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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