Skip to content

Data Migrations

gmartin7 edited this page Mar 15, 2013 · 12 revisions

##1. In C:\FwWW\Src\FDO\MasterFieldWorksModel.xml

###a) Change the version number (e.g. 7000029 to 7000030; see this line in the file) <EntireModel xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="7000029" xsi:noNamespaceSchemaLocation="MasterFieldWorksModel.xsd">

###b) Add a comment near the top

###c) If the model has changed (and not just data) then make an additional change to this file to add to the model or change it: e.g. <basic num="42" id="ExtLinkRootDir" sig="Unicode">

changed to....

<basic num="42" id="LinkedFilesRootDir" sig="Unicode">

##2. For special cases like this one we have LinkedFilesRootDir in C:\FwWW\Src\FDO\FDOGenerate\HandGenerated.xml so the change was needed there also. (What sort of special cases? Really?)

##3. Make whatever other changes to the code are required by the model change. e.g. LangProjectTags.kflidExtLinkRootDir

to

LangProjectTags.kflidLinkedFilesRootDir

##4. Files that need to be checked out and changed

###C:\FwWW\Src\FDO\MasterFieldWorksModel.xml

###C:\FwWW\Src\FDO\FDOGenerate\HandGenerated.xml (possibly)

###C:\FwWW\DistFiles\Templates\NewLangProj.fwdata

In here change the version number for example from 7000028 to 7000029 (at the top of the file) Don't forget to do this. You will regret it!

###C:\FwWW\Src\FDO\DomainServices\DataMigration\IDataMigrationManager.cs(167)

In here just make an addition like the following:

m_individualMigrations.Add(7000029, new DataMigration7000029());

###Once the migration is ready to check in

  • Check out these 4 files, (EXCEPT they aren't in our repo anymore!)

C:\FwWW\DistFiles\ReleaseData\Sena 2\Sena 2.fwdata

C:\FwWW\DistFiles\ReleaseData\Sena 3\Sena 3.fwdata

C:\FwWW\DistFiles\ReleaseData\Lela-Teli 2\Lela-Teli 2.fwdata

C:\FwWW\DistFiles\ReleaseData\Lela-Teli 3\Lela-Teli 3.fwdata

  • Open them in Flex (so that the migration is performed on them)
  • Check them in along with any other files you are checking in for the migration..

##5. New files created

Create new versions of the following 3 files.

###a) C:\FwWW\Src\FDO\FDOTests\TestData\DataMigration7000029Tests.xml This is a stripped down version of a project which contains the pertinent objects in it which can be used to test that the migration is working correctly. Look at other test data to see what might be required for your test.

###b) C:\FwWW\Src\FDO\FDOTests\DataMigrationTests\DataMigration7000029Tests.cs This is the test which demonstrates that the project in DataMigration7000029Tests.xml actually migrates correctly.

###c) C:\FwWW\Src\FDO\DomainServices\DataMigration\DataMigration7000029.cs This is the code that actually does the migration. Look at other migrations for examples of how things are done.

##6. Tips for writing the actual Migration Code

When creating the above 3 new files it makes sense to copy them from a previous version.

Then do a search in all files for:

70000xx (whatever version you copied from)

doing this will show you where comments and code need to be changed.

Here's an example search.

Find all "7000024", Match case, Whole word, Subfolders, Find Results 1, "C:\FwWW\Src", "*.cs;"

C:\FwWW\Src\FDO\DomainServices\DataMigration\DataMigration7000024.cs(30): /// Migrate data from 7000023 to 7000024.

C:\FwWW\Src\FDO\DomainServices\DataMigration\DataMigration7000025.cs(23): /// Migrate data from 7000024 to 7000025.

C:\FwWW\Src\FDO\DomainServices\DataMigration\DataMigration7000025.cs(40): DataMigrationServices.CheckVersionNumber(domainObjectDtoRepository, 7000024);

C:\FwWW\Src\FDO\DomainServices\DataMigration\IDataMigrationManager.cs(167): m_individualMigrations.Add(7000024, new DataMigration7000024());

C:\FwWW\Src\FDO\FDOTests\DataMigrationTests\DataMigration7000024Tests.cs(11): /// Test framework for migration from version 7000023 to 7000024.

C:\FwWW\Src\FDO\FDOTests\DataMigrationTests\DataMigration7000024Tests.cs(18): /// Test the migration from version 7000023 to 7000024.

C:\FwWW\Src\FDO\FDOTests\DataMigrationTests\DataMigration7000024Tests.cs(51): m_dataMigrationManager.PerformMigration(dtoRepos, 7000024);

C:\FwWW\Src\FDO\FDOTests\DataMigrationTests\DataMigration7000024Tests.cs(188): Assert.AreEqual(7000024, dtoRepos.CurrentModelVersion, "Wrong updated version.");

C:\FwWW\Src\FDO\FDOTests\DataMigrationTests\DataMigration7000025Tests.cs(12): /// Test framework for migration from version 7000024 to 7000025.

C:\FwWW\Src\FDO\FDOTests\DataMigrationTests\DataMigration7000025Tests.cs(65): /// Test the migration from version 7000024 to 7000025.

C:\FwWW\Src\FDO\FDOTests\DataMigrationTests\DataMigration7000025Tests.cs(101): IDomainObjectDTORepository dtoRepos = new DomainObjectDtoRepository(7000024, dtos, mockMdc, null);

Matching lines: 11 Matching files: 5 Total files searched: 2434

Clone this wiki locally