Replies: 1 comment
-
Write migration objectsI think the best design for migrations is to create one migration object for each version upgrade. Here is a nice, explorative article about developing a system for migratin JavaScript objects: https://levelup.gitconnected.com/an-approach-to-javascript-object-schema-migration-ae1bd9f0ce78 Some points that I'd like to do differently than in the article:
Test the migrationsAfter a migration engine is created, and migration objects are written for each version, also test versions of settings files are needed. Create a git repo that contains settings files named like this:
There will be multiple folders. The Other folders could have a similar idea, to refrain from adding new content to the settings file after the first settings file version in that folder, but instead concentrate on making sure that the particular set of content present in the first settings version of that folder is able to survive all the way to the newest version. This way there could be e.g. a folder named |
Beta Was this translation helpful? Give feedback.
-
This is related to how new fields are added to the
data.json
settings file after SC version upgrades. So it's not so visible to users.Currently, migrations work by checking if the settings file lacks some newer fields, and creates the fields if they are missing. Some old fields are also renamed and their data format is changed. So far this has been working quite well, at least I haven't gotten any reports about problematic migrations.
0.12.0
will add more properties todata.json
:prompts
(main scope)fields
(prompt scope)custom_variables
(main scope)preactions
(shell command scope)variable_default_values
(shell command scope)In the future, there can be different types of prompt fields, and different kinds of preactions. All of the new types will have partially different sets of configuration properties, making it not so easy for the migration process to determine what felds should be present.
#151 will provide a mechanism to import shell commands, custom variables and prompts from external sources. This importing needs to utilize the migration system. If an imported element comes from an older version of SC, it's structure needs updating. Also, to keep exports neat and tidy, they should omit all features/properties that are not used. Those properties need to be re-added at the importing phase. But this discussion can be continued in #151.
I don't have a plan for a better migration system yet, but I'll try to think about it.
A todo list of features that don't have a complete migration support
Prompts
andPromptFields
.CustomVariables
.I can't really do development that adds new configuration fields to any of these mentioned features, until I've got the migration system to handle them, and I don't want to postpone
0.12.0
just because of developing migrations that won't be used immediately.Beta Was this translation helpful? Give feedback.
All reactions