rustprooflabs / pgosm-flex

PgOSM Flex provides high quality OpenStreetMap datasets in PostGIS (Postgres) using the osm2pgsql Flex output.
MIT License
100 stars 20 forks source link

Add check against prior PgOSM Flex version with replication #371

Closed rustprooflabs closed 9 months ago

rustprooflabs commented 9 months ago

Details

Closes #343.

When there is not a prior import tracked in osm.pgosm_flex, there is no change to output/operation. When using --replication after the initial run, details of the prior import version will be displayed. Same version:

2023-11-22 15:00:09,524:INFO:pgosm-flex:import_mode:Prior import used PgOSM Flex: 0.10.2
2023-11-22 15:00:10,580:INFO:pgosm-flex:helpers:PgOSM Flex version:  0.10.2-822ddd3

Example when PgOSM Flex used now is newer than prior.

2023-11-22 15:07:24,999:INFO:pgosm-flex:import_mode:Prior import used PgOSM Flex: 0.10.1
2023-11-22 15:07:25,020:INFO:pgosm-flex:helpers:PgOSM Flex version:  0.10.2-822ddd3

If the version used for prior import was newer, informs the user and stops.

2023-11-22 15:00:43,324:ERROR:pgosm-flex:import_mode:PgOSM Flex version (0.10.2) is lower than latest import tracked in the pgosm_flex table (0.10.3). Use PgOSM Flex version 0.10.3 or newer
2023-11-22 15:00:43,324:ERROR:pgosm-flex:pgosm_flex:Not okay to run PgOSM Flex. Exiting
Not okay to run PgOSM Flex. Exiting