Last active
August 18, 2016 21:02
-
-
Save Duder-onomy/4928dbe6f44bc15b9c24e167ffd0f962 to your computer and use it in GitHub Desktop.
Grasshopper Plugin Versioning and Migrations (thoughts)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Every GH Plugin has a version based on its package.json version. | |
When a new version of this plugin is installed | |
check the existing plugins in the DB to see if this one is allready installed, | |
if it is allready installed | |
download the plugin into a temp dir | |
look at the diff version numbers and prepare a list of migrations that need to be ran | |
migrations might work like | |
code looks at the migrations dir and looks for any versions between the version currently installed and the version desired. | |
migrations are node files named with the version they apply to, will export a 'up' and 'down' functions that return promises. | |
if migrations need to be run | |
make a copy of the DB into a temp dir. | |
put up a 'under maintenence page' | |
report the migration list back to the client side. | |
run each migration in order until the latest, reporting back to the client success or failure. | |
if all succeed | |
run the deactivate script on the old plugin version | |
copy the new one into the plugins dir from the temp dir | |
update the plugin version and pertinant deets in the db. | |
run the activate script | |
if any fail | |
report to the client which migration failed | |
restore the DB from the temp DB dir | |
if no migrations need to be ran | |
run the deactivate script on the old plugin version | |
copy the new one into the plugins dir from the temp dir | |
update the plugin version and pertinant deets in the db. | |
run the activate script | |
if it is not installed | |
just install it like normal into the plugins dir. Save the plugin and version to the DB. Run the activation script. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment