Closed leendertvanwolfswinkel closed 11 months ago
Also, in all places where the schema version of the spatialite is checked, please make it behave differently if the schema version is higher than what the plugin expects. Message to display:
"The selected spatialite cannot be used because its database schema version newer than expected. Please upgrade the 3Di Schematisation Editor and try again."
I tested two things:
threedi_schema.application.errors.MigrationMissingError: This tool cannot update versions below 160. Please consult the 3Di documentation on how to update legacy databases.
Traceback (most recent call last):
File "C:\Users\leendert.vanwolfswin\AppData\Roaming\3Di\QGIS3\profiles\From the developers desk/python/plugins\threedi_schematisation_editor\utils.py", line 739, in ensure_valid_schema
schema.validate_schema()
File "C:\Users\leendert.vanwolfswin\AppData\Roaming\3Di\QGIS3\profiles\From the developers desk\python\plugins\ThreeDiToolbox\deps\threedi_schema\application\schema.py", line 145, in validate_schema
raise MigrationMissingError(
threedi_schema.application.errors.MigrationMissingError: This tool requires at least schema version 217. Current version: 1.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\leendert.vanwolfswin\AppData\Roaming\3Di\QGIS3\profiles\From the developers desk/python/plugins\threedi_schematisation_editor\__init__.py", line 165, in load_from_spatialite
schema_is_valid = ensure_valid_schema(src_sqlite, self.uc)
File "C:\Users\leendert.vanwolfswin\AppData\Roaming\3Di\QGIS3\profiles\From the developers desk/python/plugins\threedi_schematisation_editor\utils.py", line 749, in ensure_valid_schema
schema.upgrade(backup=False, upgrade_spatialite_version=True)
File "C:\Users\leendert.vanwolfswin\AppData\Roaming\3Di\QGIS3\profiles\From the developers desk\python\plugins\ThreeDiToolbox\deps\threedi_schema\application\schema.py", line 114, in upgrade
raise MigrationMissingError(
threedi_schema.application.errors.MigrationMissingError: This tool cannot update versions below 160. Please consult the 3Di documentation on how to update legacy databases.
Please catch this error and display the error text ("This tool cannot update versions below 160. Please consult the 3Di documentation on how to update legacy databases.") in a popup message.
Requested changes applied.
@ldebek cool, works as I want now.
I have made some textual changes to the user messages and committed these to this branch.
Please merge :)
When saving to a spatialite that has an invalid schema, the following message is displayed:
"The spatialite you have selected could not be used for saving, because its database schema version (1) is not up to date. Please find your model revision on 3di.lizard.net/models, download the spatialite from there and try again."
Please make this consistent with the behaviour for converting spatialite to geopackage, e.g. display a dialog with "The selected spatialite cannot be used because its database schema version is out of date. Would you like to migrate your spatialite to the current schema version?"