Victor: have you considered doing this at the db level?  I've found that when 
done through ON DELETE CASCADE references in postgres these types of 
referential deletes are much faster that doing them in ruby (or any middleware).

-----Original Message-----

From:  "Victor 'Zverok' Shepelev" <[email protected]>
Subj:  Cascade delete
Date:  Mon Jan 26, 2009 3:56 pm
Size:  1K
To:  <[email protected]>


Hi.

Having the tables/models Course, Section, Topic, Question (with Question
belongs to Topic, Topic belongs to Section, Section belongs to Course), how
should I say "when Course is deleted, its sections should be deleted (with
topics and questions)", "when Section is deleted, its topics should be
deleted (with questions)"?

I've tried on_destroy processing, but it seems too long (because of
generating, for examples, separate delete request for each of 300 questions
when deleting entire Course).

Of course, I can do join's, filter's etc., but it seems "cascade delete"
request is relatively frequent one. Can it be in Sequel's API?

Thanks.

V.






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