[Glass] Migration of instances ...

Dale Henrichs via Glass glass at lists.gemtalksystems.com
Fri May 22 09:55:08 PDT 2015



On 05/21/2015 10:22 PM, itlists at schrievkrom.de via Glass wrote:
> Hello Dale,
>
> that means,
>
> * that MCPlatformSupport class>>autoMigrate also works for topaz
> imported code ?
>
> But then: how do I add a method like "migrateFrom: oldPoint instVarMap:
> aMap" which is oriented towards the "new" class design - but can only
> compiled when the new class definition is available.
If you are going to want to manage the migration yourself then you want 
to turn off autoMigrate during your load and add arrange to migrate the 
instances yourself ... you can get inspiration from the code in 
GsDeployer....
>
> But when the new class definition is recognized (during import) the
> migration is started - but then the method mentioned above is not
> available yet.
Right, the autoMigrate option is to make the GLASS/GsDevKit environment 
more like a traditional Smalltalk dev environment where class migration 
is not something you have to worry about ... for a db that may have 
billions of objects, automatic migration is not practical ..
>
> Therefore it seems for me, that when importing pure-source code via
> topaz I have to switch off auto migration and manually add source code
> to do migration after ALL source code has been imported ...
>
> Or I use
>
> doit
> GsDeployer bulkMigrate: [
>
>    /* creation code for new class shape definitions */
>
> PUMGeneralDomainObject subclass: 'CATIEnumAddressState'
> 	instVarNames: #( )
> 	classVars: #( )
> 	classInstVars: #( )
> 	poolDictionaries: #( )
> 	inDictionary: 'UserGlobals'
> 	category: 'GessCATIProject'
> 	options: #( ).
>
> and further class definitions ..
>
>    /* in addition all codes needed for migration - not possible !? */
>
> ].
> %
>
> but in this example I can not add source code for methods ... therefore
> doing it manually seems to be the only way ...

The bulkMigrate: method only makes the automatic migration a bit more 
efficient ... When you have a custom migration to do, then you can look 
at the code in GsDeployer and modify it to meet your specific needs ... 
and if you happen to come across a useful extension to GsDeployer for 
handling your custom migrations, you could share your code with the 
community:)

Dale


More information about the Glass mailing list