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?
--~--~---------~--~----~------------~-------~--~----~
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