On Thu, Oct 30, 2008 at 8:32 PM, Gaetan de Menten <[EMAIL PROTECTED]> wrote: > On Thu, Oct 30, 2008 at 7:27 PM, Stephen Soltesz > <[EMAIL PROTECTED]> wrote: > >> I've attached a simple example where I'm attempting to auto load two tables >> with a manytoone/onetomany relationship. In the given schema I'm working >> with there is no constraint on the table. >> >> The code attached has a line that will modify the table to include a >> constraint, and with it, everything works nicely. Without it, during >> setup_all() create_keys throws the exception: >> Exception: Couldn't find a foreign key constraint in table 'media' using the >> following columns: userid. >> >> I'm wondering if there's a way to autoload these tables without modifying >> this schema (it's not mine, after all :-)? > > No, it's not possible currently.
Doh! Strike that (again). Seems like I read the code too quickly yesterday... > The thing is, Elixir (nor SA) can't > guess the primaryjoin when there is no FK, so you need to pass extra > information there. Elixir will let you pass the extra info, but will > fail anyway (I didn't think about this case when I wrote that part). Attached is your example fixed. The "colname" argument is not required when providing the primaryjoin manually, and when you don't specify colname, Elixir lets you do as you please. -- Gaƫtan de Menten http://openhex.org --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
