"icylamb" <[EMAIL PROTECTED]> writes:

>  This is my ideas how to construct my wiki system. However, I found it
> troublesome if I delete a wiki from Wiki table, this means I need to
> delete all the pages that belong to that wiki (delete rows from Page).
> Please advise if I'm on the right track for this database design or
> not. Your recommendations are all welcomed!

The SQL command you're looking for is something like:

        DELETE FROM pages WHERE wiki_id = <to_be_deleted_wiki_id>;
        DELETE FROM wiki WHERE wiki_id =  <to_be_deleted_wiki_id>;

Converting it do work with SQLObject isn't all that hard (untested):

        pages = model.Pages.select(model.Pages.q.wiki.id==wiki_id)
        for page in pages:
            page.destroySelf()
        wiki = model.Wiki.get(wiki_id)
        wiki.destroySelf()

I assume that you have a foreign key from your Pages.wiki to your Wiki.id. 


-- 
Jorge Godoy      <[EMAIL PROTECTED]>

Reply via email to