Skip to content

Commit

Permalink
feat: db changes for nz_imagery_survey_index
Browse files Browse the repository at this point in the history
  • Loading branch information
YingtingChen committed Oct 31, 2024
1 parent 24d8a4a commit af0f0dd
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
-- Deploy nz-buildings:buildings_reference/add_log_column_nz_imagery_survey_index to pg

BEGIN;

ALTER TABLE buildings_reference.reference_update_log ADD imagery_survey_index boolean DEFAULT False;

COMMIT;
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ CREATE OR REPLACE FUNCTION buildings_reference.reference_update_log_insert_log(p
RETURNS integer AS
$$

INSERT INTO buildings_reference.reference_update_log (river, lake, pond, swamp, lagoon, canal, coastlines_and_islands, capture_source_area, territorial_authority, territorial_authority_grid, suburb_locality, hut, shelter, bivouac, protected_areas)
INSERT INTO buildings_reference.reference_update_log (river, lake, pond, swamp, lagoon, canal, coastlines_and_islands, capture_source_area, territorial_authority, territorial_authority_grid, suburb_locality, hut, shelter, bivouac, protected_areas, imagery_survey_index)
VALUES(CASE WHEN ('river_polygons' = ANY(p_list)) THEN True ELSE False END,
CASE WHEN ('lake_polygons' = ANY(p_list)) THEN True ELSE False END,
CASE WHEN ('pond_polygons' = ANY(p_list)) THEN True ELSE False END,
Expand All @@ -39,7 +39,8 @@ $$
CASE WHEN ('hut_points' = ANY(p_list)) THEN True ELSE False END,
CASE WHEN ('shelter_points' = ANY(p_list)) THEN True ELSE False END,
CASE WHEN ('bivouac_points' = ANY(p_list)) THEN True ELSE False END,
CASE WHEN ('protected_areas_polygons' = ANY(p_list)) THEN True ELSE False END
CASE WHEN ('protected_areas_polygons' = ANY(p_list)) THEN True ELSE False END,
CASE WHEN ('nz_imagery_survey_index' = ANY(p_list)) THEN True ELSE False END
)
RETURNING update_id;

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
-- Revert nz-buildings:buildings_reference/add_log_column_nz_imagery_survey_index from pg

BEGIN;

ALTER TABLE buildings_reference.reference_update_log DROP COLUMN imagery_survey_index;

COMMIT;
1 change: 1 addition & 0 deletions db/sql/sqitch.plan
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ buildings/remove_building_outlines_town_city_id_column 2024-08-14T03:50:02Z Ying
buildings_bulk_load/functions/bulk_load_outlines [buildings_bulk_load/functions/[email protected]] 2024-08-14T04:27:25Z Yingting Chen <[email protected]> # Remove town_city_id column in funct\nions.
buildings_bulk_load/remove_bulk_load_outlines_town_city_id_column 2024-08-14T04:32:22Z Yingting Chen <[email protected]> # Remove town_city_id column in bulk_load_outlines table
buildings_reference/functions/town_city [buildings_reference/functions/[email protected]] 2024-08-14T04:35:22Z Yingting Chen <[email protected]> # Remove functions of town_city table.
buildings_reference/add_log_column_nz_imagery_survey_index 2024-08-14T04:37:22Z Yingting Chen <[email protected]> # Add nz_imagery_survey_index column in reference_update_log.
buildings_reference/functions/reference_update_log [buildings_reference/functions/[email protected]] 2024-08-14T04:38:22Z Yingting Chen <[email protected]> # Remove town_city in reference_update_log update function.
buildings_reference/remove_suburb_locality_old_name_column 2024-08-14T04:40:22Z Yingting Chen <[email protected]> # Remove suburb_locality old name columns from FENZ
buildings_reference/drop_town_city 2024-08-14T04:45:02Z Yingting Chen <[email protected]> # Drop table town_city as it has been merged into suburb_locality.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
-- Verify nz-buildings:buildings_reference/add_log_column_nz_imagery_survey_index on pg

BEGIN;

SELECT imagery_survey_index
FROM buildings_reference.reference_update_log
WHERE FALSE;

ROLLBACK;
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ BEGIN
AND prosrc LIKE '%hut_points%'
AND prosrc LIKE '%shelter_points%'
AND prosrc LIKE '%bivouac_points%'
AND prosrc LIKE '%protected_areas_polygons%';
AND prosrc LIKE '%protected_areas_polygons%'
AND prosrc LIKE '%nz_imagery_survey_index%';
IF NOT FOUND THEN
RAISE EXCEPTION 'dataset keywords not found, should have been added.';
END IF;
Expand Down

0 comments on commit af0f0dd

Please sign in to comment.