add update check

This commit is contained in:
Ed Chalstrey 2022-04-11 10:26:39 +01:00
parent 99a8dbc63b
commit 688154d055

View File

@ -2,7 +2,7 @@
## Comments: ## Comments:
## Is dynamics_has_demolished_buildings = TRUE sufficient to prevent buildings being loaded? - No ## Is dynamics_has_demolished_buildings = TRUE sufficient to prevent buildings being loaded? - No
## Lets mark them, then see if there even are any ## Lets mark them, then see if there even are any - would want to check for entire London
## Describe these changes in PR and ask for comment if the bool is sufficient ## Describe these changes in PR and ask for comment if the bool is sufficient
## Prerequisites: ## Prerequisites:
@ -18,6 +18,10 @@
# if building.TOID not in new release_geometries # if building.TOID not in new release_geometries
# buildings.dynamics_has_demolished_buildings = TRUE # buildings.dynamics_has_demolished_buildings = TRUE
psql -c "UPDATE buildings
SET dynamics_has_demolished_buildings is true
WHERE ref_toid NOT IN ( SELECT source_id FROM release_geometries);"
############### ###############
### CHECK 2 ### ### CHECK 2 ###
############### ###############
@ -27,17 +31,17 @@
# if geometry.TOID not in builings # if geometry.TOID not in builings
# Add TOID to temp table called new_geometries # Add TOID to temp table called new_geometries
psql -c "CREATE TABLE new_geometries ( # psql -c "CREATE TABLE new_geometries (
geometry_id serial PRIMARY KEY, # geometry_id serial PRIMARY KEY,
source_id varchar(30), # source_id varchar(30),
geometry_geom geometry(GEOMETRY, 3857), # geometry_geom geometry(GEOMETRY, 3857),
longitude float, # longitude float,
latitude float # latitude float
);" # );"
psql -c "INSERT INTO new_geometries * # psql -c "INSERT INTO new_geometries *
SELECT * # SELECT *
FROM geometries # FROM geometries
WHERE source_id NOT IN ( SELECT ref_toid FROM buildings);" # WHERE source_id NOT IN ( SELECT ref_toid FROM buildings);"
# secondarily, if building.coordinates <10m away from any new_geometry.coordinates # secondarily, if building.coordinates <10m away from any new_geometry.coordinates
# older_building.dynamics_has_demolished_buildings = TRUE # older_building.dynamics_has_demolished_buildings = TRUE