Work toward #358
-link to https://github.com/colouring-london/colouring_london_analysis/blob/master/bulk_extracts/nlud_landuse_classification.sql
This commit is contained in:
parent
6b52f2c573
commit
20e9299226
@ -1,17 +0,0 @@
|
|||||||
-- Remove planning and controls fields
|
|
||||||
--Landuse is hierachical. Highest level is Order (Residential) then Group (Residential-Dwelling) then Class (Residential-Dwelling-Detached house)
|
|
||||||
--Fields could be linked when not mixed use Example: If user inputs class field (Detached-House) on front end then trigger on db automatically will populate group and order. If we go this route then a trigger is needed on the db both to run and remove this process.
|
|
||||||
--Landuse us a table as #358
|
|
||||||
-- Land use, single or mutiple classes?
|
|
||||||
ALTER TABLE buildings DROP COLUMN IF EXISTS landuse_mutiple_use;
|
|
||||||
|
|
||||||
-- Land use, how many different uses?
|
|
||||||
ALTER TABLE buildings DROP COLUMN IF EXISTS landuse_number_of_uses;
|
|
||||||
|
|
||||||
<<<<<<< HEAD
|
|
||||||
-- Land use is table with 3 levels order > group > class
|
|
||||||
DROP TABLE IF EXISTS landuse_classifications;
|
|
||||||
=======
|
|
||||||
--Land use class, group and order will be stored in a new table
|
|
||||||
DROP TABLE building_landuse IF EXISTS CASCADE;
|
|
||||||
>>>>>>> 68a9fd1b80ddfe8a206ff1d946c7b94ae83d1264
|
|
File diff suppressed because it is too large
Load Diff
28
migrations/0xx.landuse.down.sql
Normal file
28
migrations/0xx.landuse.down.sql
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
--Landuse is hierachical. Highest level is Order (ie. Residential) then Group (ie Residential-Dwelling) then Class (ie Residential-Dwelling-Detached house)
|
||||||
|
--Interface will collected most detailed (class) but visualise highest level (order)
|
||||||
|
--Landuse is a table as #358
|
||||||
|
|
||||||
|
-- Land use is table with 3 levels of hierachy (highest to lowest). order > group > class
|
||||||
|
DROP TABLE IF EXISTS landuse_classifications;
|
||||||
|
|
||||||
|
-- Land use class or classes, array object, client constrained.
|
||||||
|
ALTER TABLE buildings DROP COLUMN IF EXISTS current_landuse_class;
|
||||||
|
|
||||||
|
-- Land use order, singular. Client and db constrained.
|
||||||
|
ALTER TABLE buildings DROP COLUMN IF EXISTS current_landuse_order;
|
||||||
|
|
||||||
|
--Land use class, group and order will be stored in a new table
|
||||||
|
DROP TABLE building_landuse IF EXISTS CASCADE;
|
||||||
|
|
||||||
|
--===========================================
|
||||||
|
--
|
||||||
|
-- We also collect original landuse, structure & process is as current land use
|
||||||
|
-- We don't currently collect intermediate historic uses
|
||||||
|
--
|
||||||
|
--===========================================
|
||||||
|
|
||||||
|
-- Original Land use class or classes, array object, client constrained.
|
||||||
|
ALTER TABLE buildings DROP COLUMN IF EXISTS original_landuse_class;
|
||||||
|
|
||||||
|
-- Land use order, singular. Client and db constrained.
|
||||||
|
ALTER TABLE buildings DROP COLUMN IF EXISTS original_landuse_order;
|
30
migrations/0xx.landuse.up.sql
Normal file
30
migrations/0xx.landuse.up.sql
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
--Landuse is hierachical. Highest level is Order (Residential) then Group (Residential-Dwelling) then Class (Residential-Dwelling-Detached house)
|
||||||
|
--Interface will collected most detailed (class) but visualise highest level (order)
|
||||||
|
--Landuse is a table as #358
|
||||||
|
|
||||||
|
-- Land use is table with 3 levels of hierachy (highest to lowest). order > group > class
|
||||||
|
|
||||||
|
-- Land use class or classes, array object, client constrained. ARRAY[] is used to constrain array size. The array is limited to 250 based on Westfield Stratford as a single toid with many uses, this may want to be reduced down to reduce maximum size.
|
||||||
|
ALTER TABLE buildings ADD COLUMN IF NOT EXISTS current_landuse_class text ARRAY[250];
|
||||||
|
|
||||||
|
-- Land use order, singular. Client and db constrained with foreign key
|
||||||
|
--
|
||||||
|
ALTER TABLE buildings ADD COLUMN IF NOT EXISTS current_landuse_order text,
|
||||||
|
ADD CONSTRAINT fk_landuse_order
|
||||||
|
FOREIGN KEY ("level")
|
||||||
|
REFERENCES bulk_sources.nlud_classification_order_group ("level");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
--===========================================
|
||||||
|
--
|
||||||
|
-- We also collect original landuse, structure & process is as current land use
|
||||||
|
-- We don't currently collect intermediate historic uses
|
||||||
|
--
|
||||||
|
--===========================================
|
||||||
|
|
||||||
|
-- Original Land use class or classes, array object, client constrained.
|
||||||
|
ALTER TABLE buildings ADD COLUMN IF NOT EXISTS original_landuse_class text ARRAY[250];
|
||||||
|
|
||||||
|
-- Land use order, singular. Client and db constrained.
|
||||||
|
ALTER TABLE buildings ADD COLUMN IF NOT EXISTS original_landuse_order;
|
Loading…
Reference in New Issue
Block a user