Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert spatialite to geopackage on any migration to 300 or above #171

Open
wants to merge 11 commits into
base: master
Choose a base branch
from

Conversation

margrietpalm
Copy link
Contributor

This implements the following logic on upgrade:

  1. check version
    • (unchanged) Raise MigrationMissingError if schematisation version is too old
    • (new) Raise UpgradeFailedError if schematisation is not a spatialite but has a version of 230 or older
    • (new) Raise UpgradeFailedError if schematisation is not a geopackage but has a version of 300 or newer
  2. (unchanged) set custom epsg code, this will result in a schematisation version 230
  3. (new) upgrade to revision if revision <= 230, otherwise upgrade to 230
  4. (new) upgrade spatialite version if requested
  5. (new) if revision > 230, convert to geopackage and finish upgrade

New and changed fuctionality (with added tests):

  • Added is_geopackage and is_spatialite properties to ModelSchema
  • Modified spatial_index module to work with geopackage

Note that the test schema for several tests have been changed from in_memory_sqlite to empty_sqlite_v4 because geopackage conversion only works with a file.

* Add is_spatialite and is_geopackage to ModelSchema and use them to prevent impossible upgrades

* Modify geopackage testing to use is_geopackage and is_spatialite

* Split up migration to run geopackage conversion after migration to last spatialite version
…th in memory sqlite, by using empty_sqlite_v4 instead
@margrietpalm margrietpalm requested a review from elisalle January 17, 2025 14:06
@margrietpalm margrietpalm requested review from jpprins1 and elisalle and removed request for elisalle January 21, 2025 09:02
Copy link
Contributor

@elisalle elisalle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

very nice work

@elisalle elisalle removed the request for review from jpprins1 January 21, 2025 15:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants