db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From T E Schmitz <mail...@numerixtechnology.de>
Date Wed, 13 Jul 2005 17:31:24 GMT
Matthias Klein wrote:
> How can I implement something like ON DELETE CASCADE with Torque?
> Like: let's say table BOOK references table AUTHOR through a relation WROTE.
> Now let's say I have BOOK_ID 1 and AUTHOR_ID 1 and AUTHOR_ID 2 (because the
> book was written by 2 authors).
> Then I have the following WROTE:
> 1         1
> 1         2
> But now let's assume I wish to delete the book.
> With SQL I simply create the table WROTE with ON DELETE CASCADE so once I
> delete the book, the database also deletes all references (e.g. in WROTE)
> How can I do that with Torque?

<foreign-key foreignTable="BOOK" onDelete="cascade">
    <reference local="BOOK_ID" foreign="BOOK_ID"/>

I can't find it in the docs just now, but I am pretty certain "cascade" 
is one of the values you can assign to the /onDelete/ attribute. 
"setnull" is the other possible behaviour.



Tarlika Elisabeth Schmitz

To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org

View raw message