[Nitro] BUG: schema_inheritance - the neverending story...

Bryan Soto bryan.a.soto at gmail.com
Mon Jan 30 01:35:36 EST 2006


Hey George,

The problem outlined by manveru is the same problem Aidan submitted a patch
( http://rubyforge.org/pipermail/nitro-general/2006-January/002424.html )
for and exists in glycerin currently.

Basically, the problem is in og/lib/og/store/sql.rb, search for "def
fields_for_class". During the check for schema inheritance, only the classes
descendants are iterated over, not the full inheritance chain. This causes
schema evolution to kick in with fields being dropped and added and data
potentially being lost as manveru outlined.

Aidan's patch is at available at
http://rubyforge.org/pipermail/nitro-general/attachments/20060109/5f8a7531/og_schema_inheritance.obj

Mine is at
http://rubyforge.org/pipermail/nitro-general/attachments/20060126/543f3436/schema_inheritance.bin

Unless we didn't stumble on the correct solution, perhaps one of these
should be applied to glycerin? If so, let me know which and I'll submit the
bundle.

Thanks,

bryan

On 1/27/06, Michael Fellinger <m.fellinger at gmail.com> wrote:
>
> Hey Bryan,
>
> Thx a lot for the patch, will try it later...
> In every case we'll need the testcase for schema_inheritance, since it
> broke
> far too often in the past.
>
> You will hear from me how it works
>
> Am Friday 27 January 2006 15:46 schrieb Bryan Soto:
> > On 1/26/06, Michael Fellinger <m.fellinger at gmail.com> wrote:
> > > Hi list, hey george,
> >
> > Hey manveru, how's Japan? :)
> >
> > We've found a problem/bug with schema_inheritance while upgrading from
> > 0.25to
> >
> > > 0.27.
> > > Now, i don't really have an idea what exactly is going different now,
> but
> > > the
> > > main-problem seems to be that evolve_schema seems to cause problems.
> > > After a bit of playing around and trying to find out what is going
> wrong,
> > > we
> > > found that evolve_schema first drops the useless fields of the Class
> that
> > > will later be inherited - that looks like that:
> >
> > I've attached a script to duplicate your problem. And a patch, which
> seems
> > to make it do what you want.
> >
> > The store i'm using is psql - not yet tested with anything else because
> > this
> >
> > > is where our data is stored - so if psql doesn't work we hit a wall...
> >
> > It would actually affect all of them as it's a bug in their super class.
> > Oh, I'm on my WIndows box, so you might need to run dos2unix on the
> > attached files. Hope I got it right. I've never used Single Table
> > Inheritance before.
> >
> >
> > Bryan
> _______________________________________________
> Nitro-general mailing list
> Nitro-general at rubyforge.org
> http://rubyforge.org/mailman/listinfo/nitro-general
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/nitro-general/attachments/20060130/3e8f5635/attachment.html 


More information about the Nitro-general mailing list