-
Notifications
You must be signed in to change notification settings - Fork 232
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
First run/version migration #40
Comments
Puh, this already sounds pretty advanced for a helper framework. |
Certainly the data directory isn't cleared after an update. I think that would be bad form: all your settings gone. Let's forget about the framework, but I do think the |
Alfred-Workflow could easily clear the caches right before an update is initiated. Developers would have to check their settings in their scripts if they have made changes. Providing a simple |
It'd probably make more sense to have a >>> first_run = wf.first_run()
True
# what now?
>>> v = wf.last_version_run()
Version(1.7)
>>> if v < Version('2.0'):
migrate_v1_to_v2() |
Sounds about right! :) |
Of course, it's dependent on some implementation of semantic versioning/version string parsing. |
True, I thought we already have agreed on semantic versioning for version 2? ;) |
We had. We have. It will be semantic, but won't implement the full standard because that's rather complex. |
Added in v1.10.1. |
This is related to #35 in that a version would have to be specified one way or another.
I've run into a problem where a new version of a workflow uses a different settings and cache format to the previous version. Not deleting or updating the old files means the workflow will throw an error.
I could just change the bundle ID and not worry about it, but I'm wondering if this might be a fairly common problem, so would it be worth adding some sort of solution to Alfred-Workflow?
A simple solution may be to add a
first_run
property toWorkflow
, which would beTrue
if this particular version of the workflow had never run before. I imagine it would be implemented by checking for the existence of an empty file in the data directory, say,<datadir>/first_run/x.y.z
. If it doesn't exist,first_run
isTrue
and the file is created. On subsequent runs,first_run
would then beFalse
.That would, however, leave it up to the workflow author to devise whatever system is necessary to guess the format of the old settings/data/cache files and delete or update them as necessary.
Would it therefore be useful to have a kind of "migration framework" where a workflow author can register functions to be called to migrate data between versions, e.g.:
Whaddya think?
The text was updated successfully, but these errors were encountered: