On Jul 9, 1:51 pm, cult hero <[email protected]> wrote:
> So... compound primary keys are easy enough to set up in a migration:
>
> primary_key [:pkey1, :pkey2]
>
> How do I make a compound foreign key from that in a migration so the
> constraints are set up properly?

  foreign_key [:fkey1, :fkey2], :other_table

> And, when making associations, (like a simply one_to_many) do I just
> pass an array of symbols to the :key and/or :primary_key options?

Sequel's default associations don't support composite keys.  You'll
have to use the :dataset, :eager_loader, and :eager_grapher options to
create custom associations.  I'd be willing to accept a patch to add
composite key support for the default associations, as long as it came
with good specs, wasn't too invasive, and didn't significantly hurt
performance.  Alternatively, you may just want to work on a plugin
that supports composite keys. Just copy the associations.rb file and
modify it, as associations are just a plugin.

Jeremy
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sequel-talk" 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/sequel-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to