[Glass] Grrrr cannot migrate (class rename with subclasses and with a name of a deleted class)

James Foster via Glass glass at lists.gemtalksystems.com
Wed Aug 26 15:59:04 PDT 2015


Mariano,

As I understand it, the class you want to remove has no instances and then you want to simply rename another class. I don’t see that migration is required (though we can revisit that). Consider the following:

Object
- FaSecurityClosingPriceRecord (no instances)
- SpecialSuperclass
- - FaSecurityClosingPriceRecord2
- - - FSCPR2a (instances)
- - - FSCPR2b (instances)

| myClass |
UserGlobals removeKey: #'FaSecurityClosingPriceRecord'.
myClass := UserGlobals removeKey: #'FaSecurityClosingPriceRecord2'.
myClass _beVariantWhile: [myClass name: #'FaSecurityClosingPriceRecord'].
UserGlobals at: #'FaSecurityClosingPriceRecord' put: myClass.

This works with a basic GemStone image; I’m not sure what it does to the various Monticello structures, but you can investigate it. Does that do what you want?

James

> On Aug 26, 2015, at 3:16 PM, Mariano Martinez Peck via Glass <glass at lists.gemtalksystems.com> wrote:
> 
> Hi guys,
> 
> Sorry to bother again but I really can't migrate. I tried everything, nothing worked. I admit I have a weird scenario, but still.
> 
> - I have a class FaSecurityClosingPriceRecord which has no instance nor subclasses. 
> - I have a separate class called FaSecurityClosingPriceRecord2 (yes, don't ask please) which a special superclass and also have 2 subclasses (this is a different hierarchy than  than FaSecurityClosingPriceRecord). Both subclasses do have instances. 
> 
> So...what I need to do is remove old class FaSecurityClosingPriceRecord and rename FaSecurityClosingPriceRecord2 to FaSecurityClosingPriceRecord. And of course, migrating the sub instances.  I tried the following (in order)
> 
> 1) First monticello commit only the removal of FaSecurityClosingPriceRecord. Then upload code, commit and #doBulkMigrate.
> 
> 2) Monticello commit where I rename FaSecurityClosingPriceRecord2 to FaSecurityClosingPriceRecord (so subclasses now are subclass of FaSecurityClosingPriceRecord). And I made a copy of FaSecurityClosingPriceRecord and call it FaSecurityClosingPriceRecord2. So to sum up, I have both classes (being equal) FaSecurityClosingPriceRecord and FaSecurityClosingPriceRecord2 and just that FaSecurityClosingPriceRecord is the one that has the subclasses.
> 
> 3) Then I tried something like:
> 
> FaSecurityClosingPriceRecord2 addNewVersion: FaSecurityClosingPriceRecord.		System commit. 
> FaSecurityClosingPriceRecord2 migrateInstancesTo: FaSecurityClosingPriceRecord.
> FaSecurityClosingPriceRecord2 removeFromSystem. 
> 
> But that didn't work at all. 
> 
> So...how should be the steps I can do to make this refactor/migration? I found no example of classes with subclasses and renaming one in the middle of hierarchy in the guide, so I wonder if this is a special case or not. 
> 
> Thanks in advance!				
> 
> 
> -- 
> Mariano
> http://marianopeck.wordpress.com <http://marianopeck.wordpress.com/>
> _______________________________________________
> Glass mailing list
> Glass at lists.gemtalksystems.com
> http://lists.gemtalksystems.com/mailman/listinfo/glass

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gemtalksystems.com/mailman/private/glass/attachments/20150826/ce00d3cc/attachment.html>


More information about the Glass mailing list