[Glass] Grrrr cannot migrate (class rename with subclasses and with a name of a deleted class)
Martin McClure via Glass
glass at lists.gemtalksystems.com
Wed Aug 26 16:16:17 PDT 2015
On 08/26/2015 03:59 PM, James Foster via Glass wrote:
> 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.
>
I recommend against the use of _beVariantWhile: if there's an
alternative -- it's a dangerous tool. In this case there is an
alternative: #changeNameTo:. So you could do this as:
UserGlobals
removeKey: #'FaSecurityClosingPriceRecord';
at: #'FaSecurityClosingPriceRecord'
put: FaSecurityClosingPriceRecord2.
FaSecurityClosingPriceRecord2
changeNameTo: #'FaSecurityClosingPriceRecord'.
UserGlobals
removeKey: #'FaSecurityClosingPriceRecord2'.
Regards,
-Martin
More information about the Glass
mailing list