I've the feeling only one deployed version is supported : Am I correct? Our application is deployed on many servers, so different versions are deployed at any given time and we need migration to latest version to be as smooth as possible. Let's say I want to allow upgrade to latest version (1.0.1.123). If oldversion is smaller than 1.0.1.0, I have some migration code to execute. If oldversion is 1.0.1.X, there is nothing to do. How should I implement my Upgrader class so that I can migrate from 1.0.0.23 and 1.0.1.42 to the latest version 1.0.1.123 ? In other words, is there a pattern to change migration code depending on the old version? Regards, Julien Updated at 15.06.2010 14:23:00I understand this would be the scenario for a complex schema migration scenario. It is a complex scenario but required in this case. However I must be able to do the same in a very simple scenario: I will give an example.
I should be able to write an UpgradeHandler that can migrate from v1 to v3 and v2 to v3. How can I do this? I could write an UpgradeHandler that allow upgrade from any previous version, and performs conditional upgrade depending on OldVersion. However the old version does not seem to be available in UpgradeContext object of UpgradeHandler class. Is this possible to use the old version provided in CanUpgradeFrom method? Is there a 'clean' way to get the old version? Regards, This thread was imported from our support forum. The original discussion may contain more detailed answer. |
To simplify everything, let's consider there is v1, v2 and v3. Moreover,
We must be able to migrate from v1 to v3 as well. It's easy to achieve this, if v3 is shipped with a subset of v2 allowing to run its Domain to perform upgrade. Or, if there is v4, it should contain both v2 and v3 assemblies somewhere to perform incremental upgrade. So I would:
That's it. The problem with such upgrades is actually related to multple versions of mappings:
So if you really need this kind of upgrade, I recommend you to rely on regular SQL here. Upgrade pattern we use isn't designed for such multi-version upgrades. |