From 315c028c6a23dd21b089735f0093d492232cd54c Mon Sep 17 00:00:00 2001 From: MeldaS Date: Wed, 1 Apr 2020 12:15:59 +0100 Subject: [PATCH] Create SQL scipts for construction category --- .../0xx.construction-materials.down.sql | 8 ++++ migrations/0xx.construction-materials.up.sql | 38 +++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 migrations/0xx.construction-materials.down.sql create mode 100644 migrations/0xx.construction-materials.up.sql diff --git a/migrations/0xx.construction-materials.down.sql b/migrations/0xx.construction-materials.down.sql new file mode 100644 index 00000000..74a6f51d --- /dev/null +++ b/migrations/0xx.construction-materials.down.sql @@ -0,0 +1,8 @@ + +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 new file mode 100644 index 00000000..f10eca90 --- /dev/null +++ b/migrations/0xx.construction-materials.up.sql @@ -0,0 +1,38 @@ +-- 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;