[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 15:50:21 PDT 2015


On Wed, Aug 26, 2015 at 7:40 PM, Dale Henrichs via Glass <
glass at lists.gemtalksystems.com> wrote:

> Mariano,
>
> I'm not a class migration expert ... I'm aware of some of the special
> problems/limitations of the auto migration code, but I really haven't
> studied the ins/outs of custom migration plans...
>
> With that said, I will take a crack at helping ...
>
> First a question: are 1), 2), 3) three separate steps along the way to a
> single end or are they three separate attempts to "solve the problem"?
>
>
Separate steps (one attempt). I tried others, but failed too.


> When you say it didn't work, are you getting errors; or are you ending up
> with missing classes or incorrect structure?
>
>
I mess up the class hierarchy. For instance, those 2 subclases would have
as the superclass the superclass of the one expected. Or I would end having
2 kind of the same class but different. Or I would end with a class
hierarchy that look correct, but then doing a #listInstanecs: would fail
with some problem too.


> Hopefully someone who has done something similar to this will step in
> before I start reading documentation and code:)
>
>
Hopefully! I have done class rename migrations in the past. But this one
has 2 things I didn't have before:

1) the class I am renaming has subclasses (and subinstances)
2) the class I am renaming is to rename it to a name that already existed
in the system (so I am not sure if everything is correctly removed when I
delete this class with MC).

Maybe I should just try to rename it to a different name and see if the
problem is either 1) or 2).... But even this (if I would rename it to a
different none ever existing name) I still don't know how to do the
migration. Would that be automatic (meaning I simply do the rename and do a
#bulkMigrate) ? do I need to keep both classes and perform the
#addNewVersion: and #migrateInstances: ? if true, which one belongs as the
superclass of the subclasses? etc..

Thanks Dale, maybe someone jumps in :)




> Dale
>
>
>
> On 8/26/15 3:16 PM, Mariano Martinez Peck via Glass 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
>
>
> _______________________________________________
> Glass mailing listGlass at lists.gemtalksystems.comhttp://lists.gemtalksystems.com/mailman/listinfo/glass
>
>
>
> _______________________________________________
> Glass mailing list
> Glass at lists.gemtalksystems.com
> http://lists.gemtalksystems.com/mailman/listinfo/glass
>
>


-- 
Mariano
http://marianopeck.wordpress.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gemtalksystems.com/mailman/private/glass/attachments/20150826/2a3ae020/attachment-0001.html>


More information about the Glass mailing list