kamatsuoka / goodtags

a tag app, but good
MIT License
6 stars 3 forks source link

Only download databases with valid schema versions #21

Closed FuegoFro closed 6 months ago

FuegoFro commented 6 months ago

This extends the manifest format to have a mapping from schema version to db name and updates the app to only download databases that match the schema version it's expecting. This would allow us to publish multiple schema versions simultaneously if needed and helps ensure that bumping the schema in the future won't break existing apps (they'll just get more and more out of date once we stop generating that schema version).

This means that the download logic (both the downloadLatestSearchDb.ts and sqlUtil.ts) no longer need to know what the database is named on the remote, so the hacky .otf information is solely contained in the generation script. It also updates the two downloaders to share constants (most notably what schema version is valid) to reduce the chance of drift.

FuegoFro commented 6 months ago

I've tested this in my fork, including testing the compile time and runtime db downloading. You can see the new manifest structure at https://fuegofro.github.io/goodtags/manifest.json (to test you just need to change the new REMOTE_ASSET_BASE_URL constant to have fuegofro instead).