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:
commit
ee64c301cd
@ -13,18 +13,3 @@ ALTER TABLE buildings DROP COLUMN IF EXISTS current_landuse_group;
|
|||||||
|
|
||||||
-- Land use order, singular. Client and db constrained.
|
-- Land use order, singular. Client and db constrained.
|
||||||
ALTER TABLE buildings DROP COLUMN IF EXISTS current_landuse_order;
|
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;
|
|
||||||
|
16
migrations/0xx.type-extend.down.sql
Normal file
16
migrations/0xx.type-extend.down.sql
Normal 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;
|
14
migrations/0xx.type-extend.up.sql
Normal file
14
migrations/0xx.type-extend.up.sql
Normal 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
|
Loading…
Reference in New Issue
Block a user