I guess I should not have assumed sqlite supports what the syntax can
offer. Thanks for the help. However, I am not understanding your
reference for Advanced Associations. I followed the example in the
Sequel README to set it up. But I could be missing something. Should
the sqlite schema dump show a join explicitly?

http://sequel.rubyforge.org/rdoc/files/README.html


On Oct 24, 9:38 pm, "Todd Benson" <[EMAIL PROTECTED]> wrote:
> On Fri, Oct 24, 2008 at 7:49 PM, Bill Christian
>
>
>
> <[EMAIL PROTECTED]> wrote:
>
> > Ok. Based on the limited information I found, I would've expected this
> > to be pretty straightforward. But, I am still unsuccessful. I have the
> > following sqlite3 tables defined via sequel.
>
> > sqlite> .schema
> > CREATE TABLE `cards` (`id` integer PRIMARY KEY AUTOINCREMENT, `name`
> > string UNIQUE NOT NULL, `cost` string, `color` string, `type` string,
> > `power` string, `toughness` string, `rules` text, `archetype` string,
> > `subtype` string, `creature` string, `artifact` string, `legend`
> > string);
> > CREATE TABLE `cards_sets` (`id` integer PRIMARY KEY AUTOINCREMENT,
> > `card_id` integer REFERENCES `cards` ON DELETE CASCADE, `set_id`
> > integer REFERENCES `sets`, `rarity` string);
> > CREATE TABLE `sets` (`id` integer PRIMARY KEY AUTOINCREMENT, `name`
> > string UNIQUE NOT NULL, `code` string UNIQUE, `released` date);
> > CREATE INDEX `cards_name_index` ON `cards` (`name`);
> > CREATE INDEX `cards_sets_card_id_index` ON `cards_sets` (`card_id`);
> > CREATE INDEX `cards_sets_set_id_index` ON `cards_sets` (`set_id`);
> > CREATE INDEX `cards_type_index` ON `cards` (`type`);
>
> > And, I am executing the following code:
>
> > class Card < Sequel::Model
> >  many_to_many :sets
> > end
>
> > class Set < Sequel::Model
> >  many_to_many :cards
> > end
>
> > class Edition < Sequel::Model(:cards_sets)
> > end
>
> > e = Edition.filter(:set_id => 58)
> > => #<Sequel::SQLite::Dataset: "SELECT * FROM `cards_sets` WHERE
> > (`set_id` = 58)">
> > e.count
> > => 180
> > e.destroy
> > => 180
> > irb(main):068:0> e.count
> > => 0
>
> > Yet the cards table shows no deletions. I would have expected deleting
> > from the Edition table would cascade the deletes to the cards table.
> > Any ideas on what I am doing wrong?
>
> I don't think SQLite enforces foreign key constraints yet.
>
> Also, your code looks strange according 
> to...http://sequel.rubyforge.org/rdoc/files/doc/advanced_associations_rdoc...
>
> You can tell because there's no JOIN in the generated SQL.
>
> Todd
--~--~---------~--~----~------------~-------~--~----~
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