Typically a VersionHandler will take a to_version and yeild an iterator of
Typically a call to a VersionHandlers next_version_set with a db_version
of 1 and a to_version of 5 will iterate over something like the following:
or maybe just
Really how the version sets are arranged is up to the
VersionHandler being used.
In some cases users will not want versions to have inherent previous
versions, which is why the version set is an ArrayRef. In those cases the
user should opt to returning merely the version that the database is being
upgraded to in each step.
One idea that has been suggested to me has been to have a form of dependency
management of the database versions. In this case the versions are actually
more like features that may or may not be applied. For example, one might
start with version 1 and have a feature (version) users.
Each feature might require that the database be upgraded to another version
first. If one were to implement a system like this, here is how the
VersionHandlers next_version_set might look.
to_version = "users", db_version = 1
So what just happened there is that users depends on version 5, which depends
on version 3, which depends on version 1, which is already installed. To be
clear, the reason we use single versions instead of version pairs is because
there is no inherent order for this type of database upgraded.
For the typical case downgrades should be easy for users to perform and
understand. That means that with the first two examples given above we can use
the previous_version_set iterator to yeild the following:
db_version = 5, to_version=1
or maybe just
Note that we do not swap the version number order. This allows us to remain
consistent in our version set abstraction, since a version set really just
describes a version change, and not necesarily a defined progression.