On Jan 30, 5:57 am, "Gaetan de Menten" <[EMAIL PROTECTED]> wrote:
> Try:
> polymorphic="my_col"
> It should work. But, I just saw that this was an undocumented
> feature... Sorry for that.

That did work, so that helps a little. I should probably more fully
explain since others migrating an application from SQLObject may hit
this. It has to do with retaining a db schema during a migration so
that both apps can run at once. SQLObject handles inheritance slightly
differently:

1) Instead of 'row_type', its 'child_name'  (Which I set polymorphic=
to, and that fixed one part)
2) Instead of using the lower-case inherited table name, it uses the
class title-case name
3) Instead of having a primary key on the inherited tables of
'parent_id', its just 'id'

So using the polymorphic fixed #1. Fixing #2 can be done *if* Elixir
actually passed through polymorphic_identity to the mapper as it
should when I do:

class Party(Role):
    using_options(inheritance='multi', polymorphic='child_name')
    using_mapper_options(polymorphic_identity='Party')

I've manually evaded this by doing the following in my __init__:
  Party.mapper.polymorphic_map['Party'] =
Party.mapper.polymorphic_map['party']

This still won't let you load a Party though, because its going to
attempt to join the Party to the Role doing 'party.role_id = role.id',
and there is no 'role_id' in Party, since SQLObject just used 'id'. So
I did:
    Party.table.c.role_id.name = 'id'

And now I can load a Party ok..... except none of the many-to-many's
work, because they still look for 'role_id' on the Party table.
Setting autoprimary_key to a string in the Party table has no effect,
nor can I see any way to make Elixir not try and use the parent
table's prefix.

So how do I fix #3?

I think having this documented will be exceptionally useful for those
wanting to migrate from SQLObject btw.

Thanks,
Ben
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"SQLElixir" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlelixir?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to