[Glass] Grrrr cannot migrate (class rename with subclasses and with a name of a deleted class)
Mariano Martinez Peck via Glass
glass at lists.gemtalksystems.com
Wed Aug 26 16:39:25 PDT 2015
I am very very glad I asked. Thank you very much guys. Cannot believe so
simply it actually was.
So..to my defense, I didn't know a class rename was possible without going
with the migration code :)
Thank you guys,
On Wed, Aug 26, 2015 at 8:16 PM, Martin McClure <
martin.mcclure at gemtalksystems.com> wrote:
> 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
>
--
Mariano
http://marianopeck.wordpress.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gemtalksystems.com/mailman/private/glass/attachments/20150826/6370f34d/attachment.html>
More information about the Glass
mailing list