Merge pull request #588 from colouring-london/feature/migrations_type_extend

Migrations to enable the original landuse to be added to site
This commit is contained in:
Tom Russell 2020-04-09 10:43:30 +01:00 committed by GitHub
commit ee64c301cd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 30 additions and 15 deletions

View File

@ -13,18 +13,3 @@ ALTER TABLE buildings DROP COLUMN IF EXISTS current_landuse_group;
-- Land use order, singular. Client and db constrained.
ALTER TABLE buildings DROP COLUMN IF EXISTS current_landuse_order;
--===========================================
--
-- 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;

View File

@ -0,0 +1,16 @@
-- Building original use, collecting both class and order
ALTER TABLE buildings DROP COLUMN IF EXISTS original_landuse_class;
-- [Disabled for launch] Date of change of use
-- This needs to pair with demolition
ALTER TABLE buildings DROP COLUMN IF EXISTS date_change_building_use;
-- 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;
-- Land use order, singular. Client and db constrained.
ALTER TABLE buildings DROP COLUMN IF EXISTS original_landuse_source;

View File

@ -0,0 +1,14 @@
-- Land use order, singular. Client and db constrained with foreign key
ALTER TABLE buildings
ADD COLUMN IF NOT EXISTS original_landuse_order text,
ADD FOREIGN KEY (current_landuse_order)
REFERENCES reference_tables.buildings_landuse_order (description);
-- Land use groups, array. Derived from classes.
ALTER TABLE buildings ADD COLUMN IF NOT EXISTS original_landuse_group text ARRAY[41];
-- 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 original_landuse_class text ARRAY[250];
--Landuse source