Skip to content

Versioning Graphs

romainAA edited this page Jul 18, 2018 · 4 revisions

It might happen at some point that the structure of graphs needs to be changed, like if an activity need to change its name or that a connection could be defined in another way, as from on object to two objects. Versioning the graph is here so that when this is done, previous graphs do not crash.

Graph version:

The current graph version number is exported in /frog/imports/ui/GraphEditor/versionUpgrades.js as GraphCurrentVersion. When the graph structure is modified, this number needs to be incremented.

Graph object upgrade functions:

This object called GraphObjUpgrades is located in /frog/imports/ui/GraphEditor/versionUpgrades.js. Its attributes have a stringified version number x as keys and consist of functions that take as input an object Graph of the format of graph version x-1 and output an equivalent object with its global structure consistent with the graphVersion x.

Graph Mongo upgrade functions:

This object called GraphIdUpgrades is located in /frog/imports/ui/GraphEditor/versionUpgrades.js. Its keys are also stringified version number x that take as input an object containing only the graphId of the graph concerned and go through all mongoDB collections needed to update the entries as needed from graphVersion x-1 to x.