From fe94a51da4856e312bb937b221592247d12570bc Mon Sep 17 00:00:00 2001 From: Mateusz Konieczny Date: Mon, 31 Jan 2022 23:07:35 +0100 Subject: [PATCH] Modify already commited migration this avoids confusing migration in repository that could damage data, as meaning of the data in database mismatched decription --- app/map_styles/polygon.xml | 2 +- .../frontend/config/category-maps-config.ts | 2 +- .../024.unclassified_buildings.down.sql | 8 ++--- migrations/024.unclassified_buildings.up.sql | 8 ++--- migrations/025.actual.sql | 33 +++++++++++++++++++ ...unclassified_buildings_tweak_name.down.sql | 19 ----------- ...5.unclassified_buildings_tweak_name.up.sql | 19 ----------- 7 files changed, 43 insertions(+), 48 deletions(-) create mode 100644 migrations/025.actual.sql delete mode 100644 migrations/025.unclassified_buildings_tweak_name.down.sql delete mode 100644 migrations/025.unclassified_buildings_tweak_name.up.sql diff --git a/app/map_styles/polygon.xml b/app/map_styles/polygon.xml index 81a89190..2a3fa09d 100644 --- a/app/map_styles/polygon.xml +++ b/app/map_styles/polygon.xml @@ -518,7 +518,7 @@ - [current_landuse_order] = "Unclassified, presumed residential" + [current_landuse_order] = "Unclassified, presumed non-residential" diff --git a/app/src/frontend/config/category-maps-config.ts b/app/src/frontend/config/category-maps-config.ts index a6f6d869..6ccdfb15 100644 --- a/app/src/frontend/config/category-maps-config.ts +++ b/app/src/frontend/config/category-maps-config.ts @@ -204,7 +204,7 @@ export const categoryMapsConfig: {[key in Category]: CategoryMapDefinition[]} = { color: '#fa667d', text: 'Agriculture' }, { color: '#53f5dd', text: 'Minerals' }, { color: '#ffffff', text: 'Vacant & Derelict' }, - { color: '#6c6f8e', text: 'Unclassified, presumed residential' } + { color: '#6c6f8e', text: 'Unclassified, presumed non-residential' } ] }, }], diff --git a/migrations/024.unclassified_buildings.down.sql b/migrations/024.unclassified_buildings.down.sql index 482b95e5..70c56e0c 100644 --- a/migrations/024.unclassified_buildings.down.sql +++ b/migrations/024.unclassified_buildings.down.sql @@ -1,4 +1,4 @@ -DELETE FROM reference_tables.landuse_classifications WHERE landuse_id = 'U14X'; -DELETE FROM reference_tables.buildings_landuse_order WHERE landuse_id = 'U14X'; -DELETE FROM reference_tables.landuse_classifications WHERE landuse_id = 'U072X'; -DELETE FROM reference_tables.buildings_landuse_group WHERE landuse_id = 'U072X'; +DELETE FROM reference_tables.landuse_classifications WHERE landuse_id = 'U15X'; +DELETE FROM reference_tables.buildings_landuse_order WHERE landuse_id = 'U15X'; +DELETE FROM reference_tables.landuse_classifications WHERE landuse_id = 'U073X'; +DELETE FROM reference_tables.buildings_landuse_group WHERE landuse_id = 'U073X'; diff --git a/migrations/024.unclassified_buildings.up.sql b/migrations/024.unclassified_buildings.up.sql index f2c45a36..79882dbc 100644 --- a/migrations/024.unclassified_buildings.up.sql +++ b/migrations/024.unclassified_buildings.up.sql @@ -3,7 +3,7 @@ INSERT INTO reference_tables.landuse_classifications (landuse_id, description, level, parent_id, is_used) VALUES -- order -('U14X','Unclassified buildings','order',NULL,True); +('U15X','Unclassified, presumed non-residential','order',NULL,True); -- equivalent to 016 migration @@ -11,7 +11,7 @@ INSERT INTO reference_tables.buildings_landuse_order (landuse_id, description) VALUES -- order -('U14X','Unclassified buildings'); +('U15X','Unclassified, presumed non-residential'); -- equivalent to 015 migration @@ -19,7 +19,7 @@ INSERT INTO reference_tables.landuse_classifications (landuse_id, description, level, parent_id, is_used) VALUES -- group -('U072X','Unclassified, likely residential','group','U14X',True); +('U073X','Unclassified, presumed non-residential','group','U15X',True); -- equivalent to 016 migration @@ -27,4 +27,4 @@ INSERT INTO reference_tables.buildings_landuse_group (landuse_id, description, parent_order_id) VALUES -- group -('U072X','Unclassified, likely residential','U14X'); +('U073X','Unclassified, presumed non-residential','U15X'); diff --git a/migrations/025.actual.sql b/migrations/025.actual.sql new file mode 100644 index 00000000..cbe2a486 --- /dev/null +++ b/migrations/025.actual.sql @@ -0,0 +1,33 @@ +INSERT INTO reference_tables.landuse_classifications +(landuse_id, description, level, parent_id, is_used) +VALUES +('U15X','Unclassified, presumed non-residential','order',NULL,True); +INSERT INTO reference_tables.buildings_landuse_order +(landuse_id, description) +VALUES +('U15X','Unclassified, presumed non-residential'); + +INSERT INTO reference_tables.landuse_classifications +(landuse_id, description, level, parent_id, is_used) +VALUES +('U073X','Unclassified, presumed non-residential','group','U15X',True); +INSERT INTO reference_tables.buildings_landuse_group +(landuse_id, description, parent_order_id) +VALUES +('U073X','Unclassified, presumed non-residential', 'U15X'); + +UPDATE buildings +SET current_landuse_order = 'Unclassified, presumed non-residential' +WHERE current_landuse_order = 'Unclassified buildings'; + +DELETE FROM reference_tables.landuse_classifications +WHERE landuse_id='U14X'; + +DELETE FROM reference_tables.buildings_landuse_order +WHERE landuse_id='U14X'; + +DELETE FROM reference_tables.landuse_classifications +WHERE landuse_id='U072X'; + +DELETE FROM reference_tables.buildings_landuse_group +WHERE landuse_id='U072X'; diff --git a/migrations/025.unclassified_buildings_tweak_name.down.sql b/migrations/025.unclassified_buildings_tweak_name.down.sql deleted file mode 100644 index a8c3f50f..00000000 --- a/migrations/025.unclassified_buildings_tweak_name.down.sql +++ /dev/null @@ -1,19 +0,0 @@ -INSERT INTO reference_tables.landuse_classifications -(landuse_id, description, level, parent_id, is_used) -VALUES -('U14X','Unclassified buildings','order',NULL,True); -INSERT INTO reference_tables.buildings_landuse_order -(landuse_id, description) -VALUES -('U14X','Unclassified buildings'); - -UPDATE buildings -SET current_landuse_order = 'Unclassified buildings' -WHERE current_landuse_order = 'Unclassified, presumed residential'; - -DELETE FROM reference_tables.landuse_classifications -WHERE landuse_id='U15X'; - - -DELETE FROM reference_tables.buildings_landuse_order -WHERE landuse_id='U15X'; diff --git a/migrations/025.unclassified_buildings_tweak_name.up.sql b/migrations/025.unclassified_buildings_tweak_name.up.sql deleted file mode 100644 index ead182cf..00000000 --- a/migrations/025.unclassified_buildings_tweak_name.up.sql +++ /dev/null @@ -1,19 +0,0 @@ -INSERT INTO reference_tables.landuse_classifications -(landuse_id, description, level, parent_id, is_used) -VALUES -('U15X','Unclassified, presumed residential','order',NULL,True); -INSERT INTO reference_tables.buildings_landuse_order -(landuse_id, description) -VALUES -('U15X','Unclassified, presumed residential'); - -UPDATE buildings -SET current_landuse_order = 'Unclassified, presumed residential' -WHERE current_landuse_order = 'Unclassified buildings'; - -DELETE FROM reference_tables.landuse_classifications -WHERE landuse_id='U14X'; - - -DELETE FROM reference_tables.buildings_landuse_order -WHERE landuse_id='U14X';